This commit is contained in:
liushiwei
2023-10-19 00:03:01 +08:00
parent 17986a574b
commit e52e62c1d5
7 changed files with 190 additions and 25 deletions

View File

@@ -148,7 +148,7 @@ function init() {
var imgObjList = document.querySelectorAll('div.aplus-v2 img')
for (var i = 0; i < imgObjList.length; i++) {
baseList.push({type: 0, index: i+1, src: imgObjList[i].getAttribute('data-src'), folder: imgsDetail})
baseList.push({type: 0, index: i+1, src: imgObjList[i].getAttribute('data-src') || imgObjList[i].src, folder: imgsDetail})
}
for (var k = 0; k < baseList.length; k++) {

View File

@@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "TEMU助手",
"description": "TEMU助手 - 自动化提高生产效率",
"version": "3.0.0",
"version": "3.0.2",
"background": {
"service_worker": "/background.js"
},

View File

@@ -80,6 +80,7 @@
</json-excel>
</template>
<ai-table
ref="table0"
:isShowPagination="false"
:tableData="list"
height="500"
@@ -104,6 +105,7 @@
</json-excel>
</template>
<ai-table
ref="table1"
:isShowPagination="false"
:tableData="last30DaySkuList"
height="500"
@@ -128,6 +130,7 @@
</json-excel>
</template>
<ai-table
ref="table2"
:isShowPagination="false"
:tableData="last30DaySkcList"
height="500"
@@ -176,6 +179,7 @@ import { Message } from 'element-ui'
"商品名称": "productName",
"店铺名称": "mallName",
"评分": "mark",
"是否热销": 'hotTag',
"SPU": "productId",
"SKC": "productSkcId",
"SKU ID": "productSkuId",
@@ -234,14 +238,16 @@ import { Message } from 'element-ui'
label: '商品名称',
"show-overflow-tooltip": true,
width: '280px',
align: 'left'
align: 'left',
fixed: 'left'
},
{
prop: 'mallName',
label: '店铺名称',
"show-overflow-tooltip": true,
width: '120px',
align: 'left'
align: 'left',
fixed: 'left'
},
{
prop: 'mark',
@@ -250,6 +256,13 @@ import { Message } from 'element-ui'
width: '80px',
align: 'left'
},
{
prop: 'hotTag',
label: '是否热销',
"show-overflow-tooltip": true,
width: '80px',
align: 'left'
},
{
prop: 'productId',
label: 'SPU',
@@ -535,7 +548,9 @@ import { Message } from 'element-ui'
methods: {
changeDataType() {
this.$nextTick(() => { //在数据加载完,重新渲染表格
this.$refs['table'+this.type].doLayout();
})
},
beforeGetList() {
this.list = []
@@ -606,6 +621,7 @@ import { Message } from 'element-ui'
data.purchaseConfig = item.purchaseConfig;
data.productSkcPicture = item.productSkcPicture;
data.mark = item.mark.toFixed(1)
data.hotTag = item.hotTag ? '是': '否'
data.mallName = this.mallName;
this.last30DaySkcList.push({

View File

@@ -107,6 +107,10 @@
:before-close="handleClose">
<ai-payment/>
</el-dialog>
<div id="kefu" @click="gotoKefu">
<label slot="reference" class="topBtn" title="联系客服"></label>
</div>
</div>
</template>
@@ -226,6 +230,9 @@ import AiPayment from "@/components/AiPayment.vue";
this.$store.dispatch('getUserInfo')
}
})
},
gotoKefu() {
window.open('https://work.weixin.qq.com/kfid/kfcaa4208f661131eba', '_blank')
}
}
}
@@ -407,4 +414,29 @@ import AiPayment from "@/components/AiPayment.vue";
}
}
}
#kefu {
position: fixed;
right: 20px;
bottom: 40px;
z-index: 999;
width: 60px;
height: 60px;
}
#kefu .topBtn {
width: 60px;
height: 60px;
background-color: #fff;
position: absolute;
left: 0;
top: 0;
border-radius: 50%;
cursor: pointer;
background-position: center center;
background-repeat: no-repeat;
background-size: 40px 40px;
-webkit-animation: wobble 250ms infinite;
animation: wobble 250ms infinite;
background-image: url('data:image/svg+xml;%20charset=utf8,%3Csvg%20t%3D%221575450105478%22%20class%3D%22icon%22%20viewBox%3D%220%200%201220%201024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20p-id%3D%222883%22%20width%3D%2248%22%20height%3D%2248%22%3E%3Cpath%20d%3D%22M609.524%20103.522c-222.89%200-403.712%20178.472-403.712%20398.78%200%20220.31%20180.823%20398.782%20403.712%20398.782%20222.889%200%20403.712-178.473%20403.712-398.781%200-220.309-180.823-398.781-403.712-398.781v48.762c196.1%200%20354.95%20156.785%20354.95%20350.019s-158.85%20350.019-354.95%20350.019-354.95-156.785-354.95-350.02c0-193.233%20158.85-350.018%20354.95-350.018v-48.762z%22%20fill%3D%22%231296db%22%20p-id%3D%222884%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M786.578%20916.34c166.45-69.217%20278.408-231.055%20278.408-414.035%200-248.026-203.847-449.219-455.457-449.219-251.619%200-455.457%20201.188-455.457%20449.22%200%2055.397%2010.152%20109.367%2029.718%20159.975%204.855%2012.56-1.39%2026.677-13.949%2031.533-12.56%204.855-26.677-1.39-31.532-13.949a490.396%20490.396%200%200%201-3.042-8.078c-1.85%200.077-3.711%200.116-5.581%200.116C58.06%20671.903%200%20614.597%200%20543.903c0-65.005%2049.09-118.69%20112.68-126.91C153.65%20182.56%20360.56%204.324%20609.528%204.324c248.962%200%20455.877%20178.24%20496.85%20412.67%2063.583%208.225%20112.669%2061.907%20112.669%20126.909%200%2070.694-58.06%20128-129.686%20128-1.89%200-3.771-0.04-5.642-0.119-47.536%20129.702-148.34%20235.841-279.493%20290.027-1.161%2033.464-29.012%2060.24-63.2%2060.24-34.925%200-63.237-27.944-63.237-62.416%200-34.471%2028.312-62.415%2063.237-62.415%2017.892%200%2034.048%207.333%2045.551%2019.12z%22%20fill%3D%22%231296db%22%20p-id%3D%222885%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M609.528%20611.405c-58.933%200-112.056-10.644-158.472-28.342-16.123-6.147-30.211-12.702-42.138-19.208-6.926-3.777-11.447-6.59-13.437-7.972-19.24-13.373-44.428%205.446-37.059%2027.688%2035.296%20106.527%20136.054%20179.913%20251.106%20179.913%20115.05%200%20215.796-73.384%20251.092-179.913%207.37-22.243-17.82-41.062-37.06-27.687-1.99%201.383-6.51%204.195-13.434%207.972-11.926%206.505-26.012%2013.06-42.133%2019.207-46.413%2017.698-99.533%2028.342-158.465%2028.342z%22%20fill%3D%22%231296db%22%20p-id%3D%222886%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E');
}
</style>

View File

@@ -10,6 +10,8 @@
<div class="content">
<ai-search-bar>
<template #left>
<el-button type="button" :icon="'el-icon-delete'" :class="'el-button el-button--primary'" @click="batchRemove()">删除</el-button>
<el-button type="button" :class="'el-button el-button--primary'" @click="batchCollect()">批量采集</el-button>
<el-button type="button" :class="'el-button el-button--primary'" @click="addStore()">添加关键字</el-button>
</template>
<template #right>
@@ -22,6 +24,7 @@
:total="total"
style="margin-top: 8px;"
:current.sync="search.current" :size.sync="search.size"
@selection-change="onChooseChange"
@getList="getList">
<el-table-column slot="options" label="操作" width="200px" show-overflow-tooltip align="center" fixed="right">
<template slot-scope="{ row }">
@@ -87,6 +90,7 @@ import { Message } from 'element-ui'
size: 10
},
colConfigs: [
{ type: "selection", width: '70px', align: 'left' },
{ prop: 'content', label: '关键字', align: 'left' },
{ prop: 'orderType', label: '排序方式', align: 'left', format: v => this.$dict.getLabel('monitor_order_type', v) },
{ prop: 'lastUpdateTime', label: '最后一次更新时间', align: 'left' },
@@ -107,7 +111,10 @@ import { Message } from 'element-ui'
pageNo: 1,
pageSize: 120,
isLoading: false
isLoading: false,
selectRows: [],
isBatchCollect: false
}
},
@@ -127,6 +134,9 @@ import { Message } from 'element-ui'
this.total = res.data.total
})
},
onChooseChange (val) {
this.selectRows = val;
},
saveStore () {
this.$refs.form.validate((valid) => {
if (valid) {
@@ -163,6 +173,46 @@ import { Message } from 'element-ui'
})
})
},
batchRemove() {
if (this.selectRows.length <= 0) {
this.$message.error('请选择要删除的监测对象');
return;
}
let ids = this.selectRows.map(item => {
return item.id
})
this.$confirm('确定要删除?', '温馨提示', {
type: 'warning'
}).then(() => {
this.$http.post('/api/monitor/delByIds', ids
).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
batchCollect () {
if (this.selectRows.length <= 0) {
this.$message.error('请选择要采集的监测对象');
return;
}
this.isBatchCollect = true
this.isLoading = true
this.selectRows.map((item, index) => {
setTimeout(() => {
this.pageNo = 1
let data = {}
data.monitorId = item.id
data.details = []
this.beginCollect(item, data, index)
}, 1000*(index+1))
})
},
deleteMonitor(id) {
this.$confirm('确定要删除?', '温馨提示', {
type: 'warning'
@@ -193,25 +243,32 @@ import { Message } from 'element-ui'
this.isDlgShow = true
},
toBegin(row) {
this.detailsVo = {}
this.detailsVo.monitorId = row.id
this.detailsVo.details = []
this.isBatchCollect = false
this.pageNo = 1
this.isLoading = true
this.beginCollect(row)
let data = {}
data.monitorId = row.id
data.details = []
this.beginCollect(row, data, 0)
},
beginCollect(row) {
beginCollect(row, reqData, index) {
sendChromeWebReqMessage({
type: 'temu',
url: 'https://www.temu.com/search_result.html?search_key='+row.content+'&search_method=user&filter_items='+row.orderType
}).then((res) => {
this.isLoading = false
if (this.isBatchCollect && (index+1) == this.selectRows.length) {
this.isLoading = false
this.isBatchCollect = false
} else {
this.isLoading = false
}
if (res.indexOf("rawData") == -1) {
Message.error("请检查地址是否正确或者“TEMU”网站是否出现图形验证码")
return
}
let str = res.substring(res.indexOf("rawData"))
let str = res.substring(res.indexOf("window.rawData"))
str = str.substring(0, str.indexOf("<\/script>"))
str = str.substring(str.indexOf("{"))
str = str.substring(0, str.lastIndexOf("}"))
@@ -232,7 +289,7 @@ import { Message } from 'element-ui'
total = total * 1000000
}
}
this.detailsVo.details.push({
reqData.details.push({
url: item.linkUrl,
price: item.priceInfo.priceSchema,
saleTotal: total,
@@ -242,7 +299,7 @@ import { Message } from 'element-ui'
})
})
this.$http.post('/api/monitorDetail/addDetails',this.detailsVo).then(res => {
this.$http.post('/api/monitorDetail/addDetails', reqData).then(res => {
if (res.code == 0) {
this.$message.success('关键字【' + row.content + '】数据采集成功!')
this.getList()

View File

@@ -10,6 +10,8 @@
<div class="content">
<ai-search-bar>
<template #left>
<el-button type="button" :icon="'el-icon-delete'" :class="'el-button el-button--primary'" @click="batchRemove()">删除</el-button>
<el-button type="button" :class="'el-button el-button--primary'" @click="batchCollect()">批量采集</el-button>
<el-button type="button" :class="'el-button el-button--primary'" @click="addStore()">添加店铺</el-button>
</template>
<template #right>
@@ -21,6 +23,7 @@
:col-configs="colConfigs"
:total="total"
style="margin-top: 8px;"
@selection-change="onChooseChange"
:current.sync="search.current" :size.sync="search.size"
@getList="getList">
<el-table-column slot="options" label="操作" width="200px" show-overflow-tooltip align="center" fixed="right">
@@ -80,6 +83,7 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
size: 10
},
colConfigs: [
{ type: "selection", width: '70px', align: 'left' },
{ prop: 'content', label: '店铺ID', align: 'left' },
{ prop: 'lastUpdateTime', label: '最后一次更新时间', align: 'left' },
{ prop: 'status', label: '状态', align: 'left', format: v => this.$dict.getLabel('monitor_status', v), },
@@ -98,7 +102,10 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
pageNo: 1,
pageSize: 120,
isLoading: false
isLoading: false,
selectRows: [],
isBatchCollect: false
}
},
@@ -118,6 +125,9 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
this.total = res.data.total
})
},
onChooseChange (val) {
this.selectRows = val;
},
saveStore () {
this.$refs.form.validate((valid) => {
if (valid) {
@@ -136,6 +146,46 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
}
})
},
batchRemove() {
if (this.selectRows.length <= 0) {
this.$message.error('请选择要删除的监测对象');
return;
}
let ids = this.selectRows.map(item => {
return item.id
})
this.$confirm('确定要删除?', '温馨提示', {
type: 'warning'
}).then(() => {
this.$http.post('/api/monitor/delByIds', ids
).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
batchCollect () {
if (this.selectRows.length <= 0) {
this.$message.error('请选择要采集的监测对象');
return;
}
this.isBatchCollect = true
this.isLoading = true
this.selectRows.map((item, index) => {
setTimeout(() => {
this.pageNo = 1
let data = {}
data.monitorId = item.id
data.details = []
this.beginCollect(item, data, index)
}, 1000*(index+1))
})
},
renew(id) {
this.$confirm('确定要续费?', '温馨提示', {
type: 'warning'
@@ -184,16 +234,17 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
this.isDlgShow = true
},
toBegin(row) {
this.detailsVo = {}
this.detailsVo.monitorId = row.id
this.detailsVo.details = []
this.isBatchCollect = false
this.pageNo = 1
this.isLoading = true
this.beginCollect(row)
let data = {}
data.monitorId = row.id
data.details = []
this.beginCollect(row, data, 0)
},
beginCollect(row) {
beginCollect(row, reqData, index) {
sendTemuAPIMessage({
url: 'api/bg/circle/c/mall/newGoodsList',
anti: true,
@@ -203,6 +254,12 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
"page_number": this.pageNo,
"page_size": this.pageSize
}}).then((res) => {
if (this.isBatchCollect && (index+1) == this.selectRows.length) {
this.isLoading = false
this.isBatchCollect = false
} else {
this.isLoading = false
}
if (res.errorCode == 1000000) {
res.result.data.goods_list.map(item => {
let total = 0
@@ -217,7 +274,7 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
total = total * 1000000
}
}
this.detailsVo.details.push({
reqData.details.push({
url: item.link_url,
price: item.price_info.price_schema,
saleTotal: total,
@@ -229,10 +286,10 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
if (res.result.data.goods_list.length == this.pageSize) {
this.pageNo = this.pageNo + 1
this.beginCollect(row)
this.beginCollect(row, reqData, index)
} else {
this.isLoading = false
this.$http.post('/api/monitorDetail/addDetails',this.detailsVo
this.$http.post('/api/monitorDetail/addDetails', reqData
).then(res => {
if (res.code == 0) {
this.$message.success('店铺ID【' + row.content + '】数据采集成功!')

View File

@@ -343,6 +343,9 @@
created () {
this.$dict.load('rob_frequency');
},
activated () {
this.addressList = []
this.getAddressInfo();
},