文 件上传

This commit is contained in:
刘仕伟
2023-12-25 21:18:46 +08:00
parent 3db7e387f1
commit 4863fcb199
22 changed files with 1206 additions and 51 deletions

View File

@@ -81,6 +81,7 @@
<span slot="title">选品采集</span>
</template>
<el-menu-item index="/niubiCopy">商品采集</el-menu-item>
<el-menu-item index="/aliExpressCopy">速卖通采集</el-menu-item>
<el-submenu index="/track" style="padding-left: 15px;">
<template slot="title">
<span slot="title">选品跟踪</span>

View File

@@ -0,0 +1,168 @@
<template>
<div>
<ai-list class="list">
<ai-title
slot="title"
title="速卖通采集"
tips="请先在当前浏览器登录“拼多多跨境卖家中心”,期间保持登录状态"
isShowBottomBorder>
</ai-title>
<template slot="content">
<div class="content">
<ai-search-bar>
<template #left>
<div class="search-item">
<label style="width:80px">店铺</label>
<el-select v-model="search.mallId" :clearable="true" @change="search.current =1, getList()" placeholder="请选择店铺" size="small">
<el-option
v-for="item in $store.state.mallList"
:key="item.mallId"
:label="item.mallName"
:value="item.mallId">
</el-option>
</el-select>
</div>
</template>
<template #right>
<el-button type="primary" @click="search.current =1, getList()">查询</el-button>
</template>
</ai-search-bar>
<ai-search-bar>
<template #left>
<el-button type="button" :class="'el-button el-button--primary'" @click="beforeCopy()">开始采集</el-button>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 8px;"
:current.sync="search.current" :size.sync="search.size"
@getList="getList">
<el-table-column slot="url" label="商品地址" align="left">
<template slot-scope="scope">
<div v-if="scope.row.url.startsWith('http')"><a class="el-link el-link--primary" :href="scope.row.url" target="_blank">{{ scope.row.url }}</a></div>
<div v-else><a class="el-link el-link--primary" :href="'https://www.temu.com/goods.html?goods_id=' + scope.row.url" target="_blank">{{ scope.row.url }}</a></div>
</template>
</el-table-column>
<el-table-column slot="type" label="来源" width="100px" align="left">
<template slot-scope="scope">
速卖通
</template>
</el-table-column>
</ai-table>
</div>
</template>
</ai-list>
<ai-dialog
title="采集"
:visible.sync="copyFromDlgShow"
:close-on-click-modal="false"
width="790px"
customFooter
@close="handleClose">
<ai-copy-from-ali-express v-if="copyFromDlgShow" @onClose="handleClose" @onSuccess="handleSuccess"></ai-copy-from-ali-express>
</ai-dialog>
</div>
</template>
<script>
import AiCopyFromAliExpress from "@/components/AiCopyFromAliExpress.vue";
import {sendChromeAPIMessage} from '@/api/chromeApi'
import { getImageMd5 } from "@/utils/image.js"
export default {
name: 'NiubiCopy',
components: {AiCopyFromAliExpress},
data () {
return {
search: {
current: 1,
size: 10,
type: '2',
mallId: ''
},
colConfigs: [
{ slot: 'url', label: '商品地址', align: 'left' },
{ slot: 'type', label: '来源', width: '100px', align: 'left'},
{ prop: 'mallName', label: '店铺名称', width: '200px', align: 'left'},
{ prop: 'createTime', label: '复制时间', width: '180px'}
],
tableData: [],
total: 0,
copyFromDlgShow: false,
}
},
created () {
this.getList()
},
methods: {
async getList () {
let res2 = await getImageMd5('http://temu.jjcp52.com/dist/test.png')
console.log(res2)
let res3 = await sendChromeAPIMessage({
url: 'marvel-mms/cn/api/kiana/gmp/bg/phoenix/api/material/create',
needMallId: true,
mallId: '634418212443160',
data: {
folderId: 0,
createDetailList: [
{
materialType: 1,
materialMd5: res2.md5,
materialName: "test.png"
}
]
}
})
let res4 = await sendChromeAPIMessage({
url: 'galerie/business/get_signature?sdk_version=js-0.0.16-alpha.0&tag_name=product-material-tag',
needMallId: true,
mallId: '634418212443160',
data: {
bucket_tag: "product-material-tag"
}
})
let res5 = await sendChromeAPIMessage({
url: 'https://kuajing-file.pinduoduo.com/api/galerie/v3/store_image?sdk_version=js-0.0.16-alpha.0&tag_name=product-material-tag',
isFormData: true,
data: {
url_width_height: true,
image: new Uint8Array(res2.imageData),
upload_sign: res4.result.signature
}
})
console.log(res5)
this.$http.post('/api/copyProduct/myPage',null,{
params: {
...this.search
}
}).then(res => {
this.tableData = res.data.records
this.total = res.data.total
})
},
beforeCopy() {
this.copyFromDlgShow = true
},
handleClose() {
this.copyFromDlgShow = false
},
// 添加模板成功
handleSuccess() {
this.copyFromDlgShow = false
this.getList()
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -3,7 +3,7 @@
<ai-list class="list">
<ai-title
slot="title"
title="智能复制"
title="商品采集"
tips="请先在当前浏览器登录“拼多多跨境卖家中心”,期间保持登录状态"
isShowBottomBorder>
</ai-title>
@@ -11,10 +11,6 @@
<div class="content">
<ai-search-bar>
<template #left>
<div class="search-item">
<label style="width:80px">来源</label>
<ai-select :selectList="$dict.getDict('copy_from')" :clearable="true" v-model="search.type" @change="search.current =1, getList()"></ai-select>
</div>
<div class="search-item">
<label style="width:80px">店铺</label>
<el-select v-model="search.mallId" :clearable="true" @change="search.current =1, getList()" placeholder="请选择店铺" size="small">
@@ -33,7 +29,7 @@
</ai-search-bar>
<ai-search-bar>
<template #left>
<el-button type="button" :class="'el-button el-button--primary'" @click="beforeCopy()">开始复制</el-button>
<el-button type="button" :class="'el-button el-button--primary'" @click="beforeCopy()">开始采集</el-button>
</template>
</ai-search-bar>
<ai-table
@@ -49,13 +45,18 @@
<div v-else><a class="el-link el-link--primary" :href="'https://www.temu.com/goods.html?goods_id=' + scope.row.url" target="_blank">{{ scope.row.url }}</a></div>
</template>
</el-table-column>
<el-table-column slot="type" label="来源" width="100px" align="left">
<template slot-scope="scope">
TEMU
</template>
</el-table-column>
</ai-table>
</div>
</template>
</ai-list>
<ai-dialog
title="复制"
title="采集"
:visible.sync="copyFromDlgShow"
:close-on-click-modal="false"
width="790px"
@@ -77,13 +78,13 @@ import AiCopyFromTemu from "@/components/AiCopyFromTemu.vue";
search: {
current: 1,
size: 10,
type: '',
type: '1',
mallId: ''
},
colConfigs: [
{ slot: 'url', label: '商品地址', align: 'left' },
{ prop: 'type', label: '来源', width: '100px', align: 'left',format: v => this.$dict.getLabel('copy_from', v), },
{ slot: 'type', label: '来源', width: '100px', align: 'left'},
{ prop: 'mallName', label: '店铺名称', width: '200px', align: 'left'},
{ prop: 'createTime', label: '复制时间', width: '180px'}
],
@@ -94,7 +95,6 @@ import AiCopyFromTemu from "@/components/AiCopyFromTemu.vue";
},
created () {
this.$dict.load('copy_from');
this.getList()
},

View File

@@ -11,6 +11,7 @@
<script>
import List from './components/List.vue'
import Detail from './components/Detail.vue'
import SheinDetail from './components/SheinDetail.vue'
export default {
name: 'StoreTrack',
@@ -18,7 +19,8 @@
components: {
List,
Detail
Detail,
SheinDetail
},
data () {
@@ -35,6 +37,11 @@
this.params = data.params
}
if (data.type === 'SheinDetail') {
this.component = 'SheinDetail'
this.params = data.params
}
if (data.type === 'List') {
this.component = 'List'
this.params = data.params

View File

@@ -32,14 +32,22 @@
<el-button type="text" @click="deleteMonitor(row.id)">删除</el-button>
<el-button type="text" @click="toUpdateMonitor(row)">修改</el-button>
<el-button type="text" @click="renew(row.id)">续费</el-button>
<el-button type="text" @click="toDetail(row.id, row.content)">详情</el-button>
<el-button type="text" @click="toDetail(row.id, row.content, row.source)">详情</el-button>
<el-button type="text" @click="toBegin(row)">采集数据</el-button>
</div>
</template>
</el-table-column>
<el-table-column slot="content" label="店铺ID" show-overflow-tooltip align="center">
<template slot-scope="{ row }">
<div><a class="el-link el-link--primary" :href="'https://www.temu.com/mall.html?mall_id=' + row.content" target="_blank">{{ row.content }}</a></div>
<div>
<a class="el-link el-link--primary" v-if="row.source == '0'" :href="'https://www.temu.com/mall.html?mall_id=' + row.content" target="_blank">{{ row.content }}</a>
<a class="el-link el-link--primary" v-else-if="row.source == '1'" :href="'https://www.shein.com/store/home?store_code=' + row.content" target="_blank">{{ row.content }}</a>
</div>
</template>
</el-table-column>
<el-table-column slot="source" label="来源" show-overflow-tooltip align="center">
<template slot-scope="{ row }">
{{ row.source == '0' ? 'TEMU': '希音' }}
</template>
</el-table-column>
</ai-table>
@@ -66,6 +74,12 @@
:rules="[{ required: true, message: '请输入店铺ID', trigger: 'blur' }]">
<el-input placeholder="请输入店铺ID" v-model="form.mallId"></el-input>
</el-form-item>
<el-form-item label="来源" style="width: 100%;" prop="source" :rules="[{ required: true, message: '请选择来源', trigger: 'blur' }]">
<el-radio-group v-model="form.source" size="medium">
<el-radio :label="0">TEMU</el-radio>
<el-radio :label="1">希音</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
prop="remark"
label="备注"
@@ -93,6 +107,12 @@
:rules="[{ required: true, message: '请输入店铺ID', trigger: 'blur' }]">
<el-input placeholder="请输入店铺ID" disabled v-model="updateForm.mallId"></el-input>
</el-form-item>
<el-form-item label="来源:" style="width: 100%;" prop="type" :rules="[{ required: true, message: '请选择来源', trigger: 'blur' }]">
<el-radio-group disabled v-model="updateForm.source" size="medium">
<el-radio :label="0">TEMU</el-radio>
<el-radio :label="1">希音</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
prop="remark"
label="备注"
@@ -109,7 +129,7 @@
</template>
<script>
import {sendTemuAPIMessage} from '@/api/chromeApi'
import {sendTemuAPIMessage, sendSheinAPIMessage} from '@/api/chromeApi'
export default {
name: 'List',
@@ -127,6 +147,7 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
{ prop: 'remark', label: '备注', align: 'left'},
{ prop: 'lastUpdateTime', label: '最后一次更新时间', align: 'left' },
{ prop: 'status', label: '状态', align: 'left', format: v => this.$dict.getLabel('monitor_status', v), },
{ slot: 'source', label: '来源', align: 'left' },
{ prop: 'expireTime', label: '失效时间', align: 'left' },
{ prop: 'createTime', label: '添加时间', width: '180px', fixed: 'right'}
],
@@ -135,6 +156,7 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
form: {
mallId: '',
source: 0,
remark: ''
},
@@ -143,6 +165,7 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
updateForm: {
id: '',
mallId: '',
source: '',
remark: ''
},
@@ -182,7 +205,7 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
if (valid) {
this.$http.post('/api/monitor/check',null, {params: {type: 1}}).then(res => {
if (res.code == 0) {
this.$http.post(`/api/monitor/add`, {content: this.form.mallId, remark: this.form.remark, type: this.search.type}).then(res => {
this.$http.post(`/api/monitor/add`, {content: this.form.mallId, source: this.form.source, remark: this.form.remark, type: this.search.type}).then(res => {
if (res.code == 0) {
this.$message.success('添加成功!')
this.$store.dispatch('getUserInfo')
@@ -198,6 +221,7 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
toUpdateMonitor (obj) {
this.updateObj = obj
this.updateForm.mallId = obj.content
this.updateForm.source = obj.source
this.updateForm.remark = obj.remark
this.isUpdateDlgShow = true
},
@@ -248,6 +272,7 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
let data = {}
data.monitorId = item.id
data.source = item.source
data.details = []
this.beginCollect(item, data, index)
@@ -289,14 +314,25 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
})
})
},
toDetail (id, content) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || '',
content: content
}
})
toDetail (id, content, source) {
if (source == '0') {
this.$emit('change', {
type: 'Detail',
params: {
id: id || '',
content: content
}
})
} else {
this.$emit('change', {
type: 'SheinDetail',
params: {
id: id || '',
content: content
}
})
}
},
addStore() {
this.form.mallId = ''
@@ -313,7 +349,15 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
this.beginCollect(row, data, 0)
},
beginCollect(row, reqData, index) {
if (row.source == '0') {
this.beginTemuCollect(row, reqData, index)
} else if (row.source == '1') {
this.beginSheinCollect(row, reqData, index)
}
},
beginTemuCollect(row, reqData, index) {
sendTemuAPIMessage({
url: 'api/bg/circle/c/mall/newGoodsList',
anti: true,
@@ -371,6 +415,60 @@ import {sendTemuAPIMessage} from '@/api/chromeApi'
this.$message.error("采集失败请检查https://www.temu.com是否能正常访问")
}
})
},
async beginSheinCollect(row, reqData, index) {
let res = await sendSheinAPIMessage({
url: 'api/store/items/get',
method: 'GET',
params: {
_ver: '1.1.8',
_lang: 'en',
scene_id: '10188',
rule_poskey: "shoprecommend",
requestType: "pageChange",
search_type: "store",
store_code: row.content,
viewed_goods: '',
limit: 120,
page: this.pageNo
}})
if (this.isBatchCollect && (index+1) == this.selectRows.length) {
this.isLoading = false
this.isBatchCollect = false
} else {
this.isLoading = false
}
if (res.goods && res.goods.length > 0) {
res.goods.map(item => {
let total = 0
if (item.pretreatInfo?.sellingPointUniversalLabels) {
total = item.pretreatInfo.sellingPointUniversalLabels[0].starComment?.comment_num || 0
}
reqData.details.push({
url: 'https://www.shein.com/'+item.goods_url_name.replace(/ /g, '-')+'-p-'+item.goods_id+'-cat-'+item.cat_id+'.html',
price: item.salePrice.amount,
saleTotal: total,
goodsId: item.goods_id,
imgUrl: 'https:'+item.goods_img,
mallId: item.store_code
})
})
if (res.goods.length == this.pageSize) {
this.pageNo = this.pageNo + 1
this.beginCollect(row, reqData, index)
} else {
this.isLoading = false
this.$http.post('/api/monitorDetail/addDetails', reqData
).then(res => {
if (res.code == 0) {
this.$message.success('店铺ID【' + row.content + '】数据采集成功!')
this.getList()
}
})
}
}
}
}
}

View File

@@ -0,0 +1,302 @@
<template>
<div>
<ai-list class="list">
<ai-title
slot="title"
:title="'店铺ID(' + `${content}` + ')商品列表'"
isShowBottomBorder isShowBack @onBackClick="cancel(false)">
</ai-title>
<template slot="content">
<ai-search-bar>
<template #left>
<label style="width:80px">排序方式</label>
<el-select v-model="search.orderBy" :clearable="true" @change="search.current =1, getList()" placeholder="请选择排序方式" size="small">
<el-option
v-for="item in orderBys"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<label style="width:80px">价格区间</label>
<el-input :clearable="true" size="small" style="width: 80px" v-model="search.priceBegin" ></el-input>
~
<el-input :clearable="true" size="small" style="width: 80px" v-model="search.priceEnd" ></el-input>
<label style="width:80px">评论数区间</label>
<el-input :clearable="true" size="small" style="width: 80px" v-model="search.saleBegin" ></el-input>
~
<el-input :clearable="true" size="small" style="width: 80px" v-model="search.saleEnd" ></el-input>
<label style="width:100px">仅显示最新</label>
<ai-select :selectList="$dict.getDict('mall_yesno')" v-model="search.isNew"></ai-select>
<label style="width:100px">仅显示下架</label>
<ai-select :selectList="$dict.getDict('mall_yesno')" v-model="search.isOff"></ai-select>
</template>
<template #right>
<el-button type="primary" @click="search.current =1, getList()">查询</el-button>
</template>
</ai-search-bar>
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr; gap: 16px;">
<el-card v-for="item in tableData" :key="item.id" :body-style="{ padding: '0px', margin: '5px' }">
<div :class="[{'img-background': item.isSelect}, 'img-box']" v-if="item.isOff == '1'">
<div>
<el-image :src="item.imgUrl" class="mask image" :preview-src-list="[item.imgUrl]" />
</div>
<span class="icon-box">
<img style="width: 50px; height: 50px" src="../../../../assets/off.png">
</span>
</div>
<span class="nav-label labelBadge" v-else>
<span class="ii" v-if="item.isNew == 1"></span>
<el-image :src="item.imgUrl" class="image" :preview-src-list="[item.imgUrl]" />
</span>
<div style="padding: 14px;">
<div class="bottom clearfix">
<div style="margin-bottom: 5px;">
<div style="display: inline; margin-left: 5px;">${{ item.price }}<sub style="margin-left: 2px;" v-html="getPricePercent(item.priceChange)"></sub></div>
<div style="display: inline; margin-right: 5px; float: right;">{{ item.saleTotal }}<sub style="margin-left: 2px;" v-html="getSalePercent(item.saleChange)"></sub></div>
</div>
<div>
<div v-if="search.orderBy == '5'" style="display: inline">近3次日均评论数: <span style="color: red; font-weight: bold">{{ item.days3AverageSale }}</span></div>
<div v-else-if="search.orderBy == '6'" style="display: inline">近7次日均评论数: <span style="color: red; font-weight: bold">{{ item.days7AverageSale }}</span></div>
<div v-else-if="search.orderBy == '7'" style="display: inline">近15次日均评论数: <span style="color: red; font-weight: bold">{{ item.days15AverageSale }}</span></div>
<div v-else style="display: inline">日均评论数: <span style="color: red; font-weight: bold">{{ item.averageSale }}</span></div>
<ai-product-drop-down :params="item" :isHideCopy="true" :isShowDetail="true" :isShowAddFavorite="true" :isShowDelFavorite="false" @onGoDetail="goDetail(item.goodsId, item.monitorId)" style="float: right;"></ai-product-drop-down>
</div>
</div>
</div>
</el-card>
<el-pagination
layout="prev, pager, next"
style="position: absolute; bottom: 0px; right: 40px;"
:total="total"
:page-size.sync="search.size"
:current-page.sync="search.current"
@current-change="getList">
</el-pagination>
</div>
</template>
</ai-list>
<div class="productDetail">
<el-dialog
title="商品详情"
:visible="isShowDetailDlg"
:close-on-click-modal="false"
width="80%"
:before-close="handleClose">
<ai-product-detail v-if="isShowDetailDlg" :params="detailParams"/>
</el-dialog>
</div>
</div>
</template>
<script>
import AiProductDetail from "@/components/AiProductDetail.vue";
import AiProductDropDown from '@/components/AiProductDropDown.vue';
export default {
name: 'DetailPage',
props: ['params'],
components: {AiProductDetail, AiProductDropDown},
data () {
return {
monitorId: '',
content: '',
search: {
current: 1,
type: '1',
size: 120,
orderBy: '',
priceBegin: '',
priceEnd: '',
saleBegin: '',
saleEnd: '',
isNew: '',
isOff: ''
},
orderBys: [{
value: '0',
label: '按评论数涨辐排序'
},{
value: '1',
label: '按价格涨辐排序'
},{
value: '2',
label: '按评论数排序'
},{
value: '3',
label: '按价格排序'
},{
value: '4',
label: '按日均评论数排序'
},{
value: '5',
label: '按近3次采集平均评论数排序'
},{
value: '6',
label: '按近7次采集平均评论数排序'
},{
value: '7',
label: '按近15次采集平均评论数排序'
}],
tableData: [],
total: 0,
isShowDetailDlg: false,
detailParams: {}
}
},
created () {
this.$dict.load('mall_yesno');
this.monitorId = this.params.id
this.content = this.params.content
this.getList()
},
methods: {
getList () {
this.$http.post('/api/monitorDetail/myPageNew',null,{
params: {
monitorId: this.monitorId,
...this.search
}
}).then(res => {
res.data.records = res.data.records.map(item => {
item.mallId = 'https://www.shein.com/store/home?store_code=' + item.mallId
return item
})
this.tableData = res.data.records
this.total = res.data.total
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
},
getPricePercent(data) {
if (data < 0) {
return '<div style="display: inline; color: green">↓' + data + '%</div>'
} else if (data > 0) {
return '<div style="display: inline; color: red">↑' + data + '%</div>'
}
return ''
},
getSalePercent(data) {
if (data < 0) {
return '<div style="display: inline; color: green">↓' + data + '%</div>'
} else if (data > 0) {
return '<div style="display: inline; color: red">↑' + data + '%</div>'
}
return ''
},
handleClose() {
this.isShowDetailDlg = false
},
goDetail (goodsId, monitorId) {
this.detailParams = {goodsId: goodsId, monitorId: monitorId}
this.isShowDetailDlg = true
}
}
}
</script>
<style scoped lang="scss">
.productDetail {
:deep(.el-dialog) {
height: 78vh;
overflow: auto;
}
}
.time {
font-size: 13px;
color: #999;
}
.bottom {
margin-top: 13px;
line-height: 12px;
}
.button {
padding: 0;
float: right;
}
.image {
width: 100%;
display: block;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.el-dropdown-link {
cursor: pointer;
color: #409EFF;
}
.el-icon-arrow-down {
font-size: 12px;
}
/*徽标*/
.labelBadge {
position: relative;
}
.ii {
background: #f00;
border-radius: 50%;
width: 20px;
height: 20px;
top: -3px;
right: -5px;
position: absolute;
text-align: center;
color: #FFF;
z-index: 999;
font-size: 14px;
}
.img-box {
display: flex;
justify-content: center;
align-items: center;
//父级设置 相对定位,让 icon设置绝对定位时能够以该父级为准。
position: relative;
// icon 设置 绝对定位 让其固定在你想要的合适位置。 样式可调整,自己定位即可。
.icon-box {
position: absolute;
top: 35%;
}
}
.mask {
background-color: #000;
opacity: 0.6;
.el-image__inner {
opacity: 0.6;
}
}
::v-deep .mask > img {
opacity: 0.6;
}
.el-icon {
display: inline-block;
}
</style>

View File

@@ -298,12 +298,15 @@
Message.error("请选择备货单")
return
}
console.log(this.arr)
this.arr.map(item => {
let temp = this.choosedList.filter(i => {
return i.subPurchaseOrderSn == item.subPurchaseOrderSn
return i.subPurchaseOrderBasicVO?.subPurchaseOrderSn == item.subPurchaseOrderBasicVO.subPurchaseOrderSn
})
console.log(temp)
if (temp.length == 0) {
this.choosedList.push(item)
console.log(this.choosedList)
}
})
Message.success("添加成功,可继续添加")