This commit is contained in:
liushiwei
2023-09-25 10:13:54 +08:00
parent 2fb3f13787
commit 794ac780ae
11 changed files with 749 additions and 46 deletions

View File

@@ -24,6 +24,17 @@ export async function sendChromeAPIMessage(message) {
}) })
} }
/**
* 向Chrome发送消息
* @param message 消息
*/
export async function sendChromeWebReqMessage(message) {
return new Promise((resolve) => {
// @ts-ignore
chrome.runtime.sendMessage(message, resolve)
})
}
/** /**
* 向Chrome发送消息 * 向Chrome发送消息
* @param message 消息 * @param message 消息

View File

@@ -24,6 +24,72 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
resolve(res.json()); resolve(res.json());
}); });
}).then(sendResponse); }).then(sendResponse);
} else if (request.type == 'temu') {
new Promise((resolve) => {
let headers = {};
headers['Content-Type'] = 'text/html';
headers.cookie = getTemuCookie();
Promise.resolve().then(() => fetch(request.url, {
'headers': headers,
'method': 'GET',
'referrerPolicy': 'no-referrer',
'credentials': 'include',
'mode': 'cors'
})).then((res) => {
// 创建了一个数据读取器
const reader = res.body.getReader();
// 创建了一个文本解码器
const decoder = new TextDecoder();
let text = ""
reader.read().then(function processText({ done, value }) {
// Result 对象包含了两个属性:
// done - 当 stream 传完所有数据时则变成 true
// value - 数据片段。当 done 为 true 时始终为 undefined
if (done) {
resolve(text);
return;
}
// 将字节流转换为字符
text = text + decoder.decode(value)
// 再次调用这个函数以读取更多数据
return reader.read().then(processText);
});
});
}).then(sendResponse);
} else if (request.type == 'aliexpress') {
new Promise((resolve) => {
let headers = {};
headers['Content-Type'] = 'text/html';
headers.cookie = getAliexpressCookie();
Promise.resolve().then(() => fetch(request.url, {
'headers': headers,
'method': 'GET',
'referrerPolicy': 'no-referrer',
'credentials': 'include',
'mode': 'cors'
})).then((res) => {
// 创建了一个数据读取器
const reader = res.body.getReader();
// 创建了一个文本解码器
const decoder = new TextDecoder();
let text = ""
reader.read().then(function processText({ done, value }) {
// Result 对象包含了两个属性:
// done - 当 stream 传完所有数据时则变成 true
// value - 数据片段。当 done 为 true 时始终为 undefined
if (done) {
resolve(text);
return;
}
// 将字节流转换为字符
text = text + decoder.decode(value)
// 再次调用这个函数以读取更多数据
return reader.read().then(processText);
});
});
}).then(sendResponse);
} else if (request.type == 'notify') { } else if (request.type == 'notify') {
chrome.notifications.create( chrome.notifications.create(
"" + Math.random(), { "" + Math.random(), {
@@ -84,3 +150,25 @@ function getCookie() {
}); });
return cStr; return cStr;
} }
function getTemuCookie() {
const url = new URL("https://www.temu.com/");
let cStr = '';
chrome.cookies.getAll({domain: url.host}, (cookie) => {
cookie.map((c) => {
cStr += c.name + '=' + c.value + ';';
});
});
return cStr;
}
function getAliexpressCookie() {
const url = new URL("https://www.aliexpress.us/");
let cStr = '';
chrome.cookies.getAll({domain: url.host}, (cookie) => {
cookie.map((c) => {
cStr += c.name + '=' + c.value + ';';
});
});
return cStr;
}

View File

@@ -14,7 +14,9 @@
"action": { "action": {
}, },
"host_permissions": [ "host_permissions": [
"*://*.pinduoduo.com/" "*://*.pinduoduo.com/",
"*://*.temu.com/",
"*://*.aliexpress.us/"
], ],
"permissions": [ "permissions": [
"cookies", "cookies",

View File

@@ -14,7 +14,9 @@
"action": { "action": {
}, },
"host_permissions": [ "host_permissions": [
"*://*.pinduoduo.com/" "*://*.pinduoduo.com/",
"*://*.temu.com/",
"*://*.aliexpress.us/"
], ],
"permissions": [ "permissions": [
"cookies", "cookies",

View File

@@ -40,6 +40,11 @@ const router = new VueRouter({
name: 'shippingList', name: 'shippingList',
component: () => import('../view/shipping/ShippingList.vue') component: () => import('../view/shipping/ShippingList.vue')
}, },
{
path: 'waitPackageList',
name: 'waitPackageList',
component: () => import('../view/shipping/WaitPackageList.vue')
},
{ {
path: 'waitShippingList', path: 'waitShippingList',
name: 'waitShippingList', name: 'waitShippingList',
@@ -51,6 +56,11 @@ const router = new VueRouter({
name: 'copyProduct', name: 'copyProduct',
component: () => import('../view/product/CopyProduct.vue') component: () => import('../view/product/CopyProduct.vue')
}, },
{
path: 'niubiCopy',
name: 'niubiCopy',
component: () => import('../view/product/NiubiCopy.vue')
},
{ {
path: 'reducePrice', path: 'reducePrice',
name: 'reducePrice', name: 'reducePrice',

View File

@@ -160,7 +160,7 @@ import { Message } from 'element-ui'
mallName: '', mallName: '',
type: '0', type: '0',
isLoading: false, isLoading: false,
pageSize: 10, pageSize: 100,
currentPage: 1, currentPage: 1,
todayTotal: 0, todayTotal: 0,
todayMoney: 0.0, todayMoney: 0.0,
@@ -171,9 +171,11 @@ import { Message } from 'element-ui'
allProductList: [], allProductList: [],
startDate: '', startDate: '',
endDate: '', endDate: '',
skuIds: [],
jsonFields: { jsonFields: {
"商品名称": "productName", "商品名称": "productName",
"店铺名称": "mallName", "店铺名称": "mallName",
"评分": "mark",
"SPU": "productId", "SPU": "productId",
"SKC": "productSkcId", "SKC": "productSkcId",
"SKU ID": "productSkuId", "SKU ID": "productSkuId",
@@ -241,6 +243,13 @@ import { Message } from 'element-ui'
width: '120px', width: '120px',
align: 'left' align: 'left'
}, },
{
prop: 'mark',
label: '评分',
"show-overflow-tooltip": true,
width: '80px',
align: 'left'
},
{ {
prop: 'productId', prop: 'productId',
label: 'SPU', label: 'SPU',
@@ -596,6 +605,7 @@ import { Message } from 'element-ui'
data.skcExtCode = item.skcExtCode; data.skcExtCode = item.skcExtCode;
data.purchaseConfig = item.purchaseConfig; data.purchaseConfig = item.purchaseConfig;
data.productSkcPicture = item.productSkcPicture; data.productSkcPicture = item.productSkcPicture;
data.mark = item.mark.toFixed(1)
data.mallName = this.mallName; data.mallName = this.mallName;
this.last30DaySkcList.push({ this.last30DaySkcList.push({
@@ -678,7 +688,10 @@ import { Message } from 'element-ui'
} }
return temp return temp
}) })
this.getSkuDetailList() this.skuIds = this.list.map(item => {
return item.productSkuId
})
this.getSkuDetailList(0)
} }
} else { } else {
setTimeout(() => { setTimeout(() => {
@@ -690,17 +703,24 @@ import { Message } from 'element-ui'
this.isLoading = false this.isLoading = false
}) })
}, },
getSkuDetailList () { getSkuDetailList (page) {
let skuIds = this.list.map(item => { let tempSkuId = []
return item.productSkuId let i = page * 500
}) let j = 0
for (; i < this.skuIds.length; i++) {
tempSkuId.push(this.skuIds[i])
j ++
if (j == 500) break
}
if (tempSkuId.length == 0) return
sendChromeAPIMessage({ sendChromeAPIMessage({
url: 'oms/bg/venom/api/supplier/sales/management/querySkuSalesNumber', url: 'oms/bg/venom/api/supplier/sales/management/querySkuSalesNumber',
needMallId: true, needMallId: true,
mallId: this.mallId, mallId: this.mallId,
data: { data: {
"productSkuIds": skuIds, "productSkuIds": tempSkuId,
"startDate": this.startDate, "startDate": this.startDate,
// "startDate": '2023-01-17',
"endDate": this.endDate "endDate": this.endDate
}}).then((res) => { }}).then((res) => {
if (res.errorCode == 1000000) { if (res.errorCode == 1000000) {
@@ -719,9 +739,10 @@ import { Message } from 'element-ui'
} }
} }
} }
this.getSkuDetailList(page + 1)
} else { } else {
setTimeout(() => { setTimeout(() => {
this.getSkuDetailList() this.getSkuDetailList(page)
}, 1500) }, 1500)
} }
}) })

View File

@@ -47,6 +47,7 @@
</template> </template>
<el-menu-item index="/normalSendGoods">抢仓发货</el-menu-item> <el-menu-item index="/normalSendGoods">抢仓发货</el-menu-item>
<el-menu-item index="/shippingDesk">发货台管理</el-menu-item> <el-menu-item index="/shippingDesk">发货台管理</el-menu-item>
<el-menu-item index="/waitPackageList">待装箱发货单</el-menu-item>
<el-menu-item index="/waitShippingList">待收货发货单</el-menu-item> <el-menu-item index="/waitShippingList">待收货发货单</el-menu-item>
<el-menu-item index="/shippingList">已收货发货单</el-menu-item> <el-menu-item index="/shippingList">已收货发货单</el-menu-item>
</el-submenu> </el-submenu>
@@ -57,6 +58,7 @@
<span slot="title">商品管理</span> <span slot="title">商品管理</span>
</template> </template>
<el-menu-item index="/copyProduct">商品复制</el-menu-item> <el-menu-item index="/copyProduct">商品复制</el-menu-item>
<el-menu-item index="/niubiCopy">智能复制</el-menu-item>
<!--<el-menu-item index="/reducePrice">商品调价</el-menu-item>--> <!--<el-menu-item index="/reducePrice">商品调价</el-menu-item>-->
</el-submenu> </el-submenu>

View File

@@ -70,7 +70,7 @@
productName: '', productName: '',
productSkcIds: '' productSkcIds: ''
}, getProductList()">重置</el-button> }, getProductList()">重置</el-button>
<el-button type="primary" @click="search.page =1, getProductList()">查询</el-button> <el-button type="primary" @click="productPage.page =1, getProductList()">查询</el-button>
</template> </template>
</ai-search-bar> </ai-search-bar>
<ai-table <ai-table
@@ -284,7 +284,7 @@ import { Message } from 'element-ui'
}; };
}) })
} else { } else {
Message.error("【拼多多】" + res.errorMsg) this.getProductList()
} }
}); });
}, },
@@ -300,37 +300,42 @@ import { Message } from 'element-ui'
return; return;
} }
this.productIds.map((productSpu, index) => { this.productIds.map((productSpu, index) => {
setTimeout(() => { setTimeout(() => {
sendChromeAPIMessage({ this.saveTemplate(productSpu, index)
url: 'bg-visage-mms/product/query', }, 200 * index)
needMallId: true, })
mallId: this.productPage.mallId, },
data: { saveTemplate(spu, index) {
productEditTaskUid: '', sendChromeAPIMessage({
productId: productSpu url: 'bg-visage-mms/product/query',
}}).then((res) => { needMallId: true,
if (res.errorCode == 1000000) { mallId: this.productPage.mallId,
let content = transform(res.result) data: {
let mallInfo = this.$store.state.mallList.filter(item => { productEditTaskUid: '',
return item.mallId == this.productPage.mallId productId: spu
}) }}).then((res) => {
this.$http.post('/api/product/add', { if (res.errorCode == 1000000) {
mallId: mallInfo[0].mallId, let content = transform(res.result)
mallName: mallInfo[0].mallName, let mallInfo = this.$store.state.mallList.filter(item => {
productSpu: res.result.productId, return item.mallId == this.productPage.mallId
productName: res.result.productName, })
content: content this.$http.post('/api/product/add', {
}).then(res1 => { mallId: mallInfo[0].mallId,
if (res1.code == 0) { mallName: mallInfo[0].mallName,
Message.success("商品【" + res.result.productName + "】成功添加为商品模板") productSpu: res.result.productId,
if (index == this.productIds.length - 1) { productName: res.result.productName,
this.getList() content: content
} }).then(res1 => {
} if (res1.code == 0) {
}) Message.success("商品【" + res.result.productName + "】成功添加为商品模板")
if (index == this.productIds.length - 1) {
this.getList()
}
} }
}) })
}, 200 * index) } else {
this.saveTemplate(spu, index)
}
}) })
}, },
beforeAddToDraft() { beforeAddToDraft() {

View File

@@ -0,0 +1,290 @@
<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>
<el-button type="button" :class="'el-button el-button--primary'" @click="beforeCopy(1)">从TEMU复制</el-button>
<el-button type="button" :class="'el-button el-button--primary'" @click="beforeCopy(2)">从速卖通复制</el-button>
</template>
<template #right>
<el-button size="small" circle icon="el-icon-refresh-right" @click="getList()"></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">
</ai-table>
</div>
</template>
</ai-list>
<ai-dialog
title="复制"
:visible.sync="copyFromDlgShow"
:close-on-click-modal="false"
width="790px"
customFooter
@close="handleClose">
<el-form class="ai-form" :model="form" label-width="140px" ref="form">
<el-form-item label="商品来源:" v-show="false" style="width: 100%;" prop="type" :rules="[{ required: true, message: '请选择商品来源', trigger: 'blur' }]">
<el-radio-group v-model="form.type" size="medium">
<el-radio :label="1">TEMU</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="TEMU商品地址" style="width: 100%;" prop="url" :rules="[{ required: true, message: '请输入TEMU商品地址', trigger: 'blur' }]">
<el-input type="textarea" v-model="form.url"></el-input>
</el-form-item>
<el-form-item label="店铺:" style="width: 100%;" prop="targetMallId" :rules="[{ required: true, message: '请选择店铺', trigger: 'blur' }]">
<el-select style="width: 380px" v-model="form.targetMallId" placeholder="请选择">
<el-option
v-for="item in $store.state.mallList"
:key="item.mallId"
:label="item.mallName"
:value="item.mallId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="商品分类:" style="width: 100%;" prop="targetCatId" :rules="[{ required: true, message: '请选择商品分类', trigger: 'blur' }]">
<el-cascader style="width: 380px" v-model="form.targetCatId" :props="props"></el-cascader>
</el-form-item>
</el-form>
<div class="dialog-footer" slot="footer">
<el-button @click="copyFromDlgShow = false"> </el-button>
<el-button type="primary" @click="addToDraft">确定</el-button>
</div>
</ai-dialog>
</div>
</template>
<script>
import {sendChromeAPIMessage, sendChromeWebReqMessage} from '@/api/chromeApi'
import { Message } from 'element-ui'
export default {
name: 'CopyProduct',
data () {
return {
search: {
current: 1,
size: 10,
productName: '',
mallName: ''
},
props: {
value: 'catId',
label: 'catName',
lazy: true,
lazyLoad (node, resolve) {
sendChromeAPIMessage({
url: 'bg-anniston-mms/category/children/list',
needMallId: true,
data: {
parentCatId: node.value || ''
}
}).then(res => {
if (res.errorCode === 1000000) {
resolve(res.result.categoryNodeVOS.map(v => {
return {
...v,
leaf: v.isLeaf
}
}))
}
})
}
},
colConfigs: [
{ prop: 'productName', label: '商品名称', align: 'left' },
{ prop: 'mallName', label: '目标店铺', align: 'left'},
{ prop: 'createTime', label: '添加时间', width: '180px', fixed: 'right'}
],
tableData: [],
total: 0,
copyFromDlgShow: false,
form: {
url: '',
type: 1, // 默认从temu复制
targetMallId: '',
targetCatId: []
},
goods: {},
sku: {},
productDetail: {}
}
},
created () {
},
methods: {
getList () {
this.$http.post('/api/product/myPage',null,{
params: {
...this.search
}
}).then(res => {
this.tableData = res.data.records
this.total = res.data.total
})
},
// 添加模板
handleClose() {
this.copyFromDlgShow = false
},
beforeCopy(type) {
this.form.type = type
this.form.url = ''
this.copyFromDlgShow = true
},
async addToDraft() {
this.$refs.form.validate((valid) => {
if (valid) {
let source
if (this.form.type == '1') {
source = 'temu'
} else if (this.form.type == '2') {
source = 'aliexpress'
}
sendChromeWebReqMessage({
type: source,
url: this.form.url,
}).then((res) => {
if (this.form.type == '1') {
let str = res.substring(res.indexOf("rawData"))
str = str.substring(0, str.indexOf("<\/script>"))
str = str.substring(str.indexOf("{"))
str = str.substring(0, str.lastIndexOf("}"))
str = str + "}"
let goodsObj = JSON.parse(str)
this.goods = goodsObj.store.goods
this.sku = goodsObj.store.sku
this.productDetail = goodsObj.store.productDetail
let specIds = []
this.sku.forEach(item => {
item.specs.forEach(item1 => {
let flag = false
specIds.forEach(item2 => {
if (item2.specValue == item1.specValue) {
flag = true
}
})
if (!flag) {
specIds.push({specKeyId: item1.specKeyId, specValue: item1.specValue})
}
})
})
Promise.all(specIds.map(item => this.getSpecId(item).then(res => {
this.sku.forEach(item1 => {
item1.specs.forEach(item2 => {
if (item2.specValue == item.specValue) {
item2.specValueId = res.result.specId
}
})
})
return 0
}))).then(() => {
this.$http.post('/api/product/translate',{type: 1, goods: this.goods, sku: this.sku, productDetail: this.productDetail}).then(res => {
if (res.code == 0) {
this.createDraft(res.data)
}
})
})
} else if (this.form.type == '2') {
let str = res.substring(res.indexOf("runParams"))
str = str.substring(0, str.indexOf("<\/script>"))
str = str.substring(str.indexOf("{"))
str = str.substring(0, str.lastIndexOf("}"))
str = str.substring(str.indexOf('data'))
str = str.substring(5)
//str = str + "}"
console.log(str)
}
})
}
})
},
createDraft(data) {
sendChromeAPIMessage({
url: 'bg-visage-mms/product/draft/add',
needMallId: true,
mallId: this.form.targetMallId,
data: {
catId: this.form.targetCatId[this.form.targetCatId.length - 1]
}}).then((res) => {
if (res.errorCode == 1000000) {
let draftId = res.result.productDraftId
let content = data
let i = 0
for (; i < this.form.targetCatId.length; i++) {
content['cat' + (i+1) + 'Id'] = this.form.targetCatId[i]
}
for (; i < 10; i++) {
content['cat' + (i+1) + 'Id'] = ''
}
content.productDraftId = draftId
this.createProduct(content)
} else {
setTimeout(() => {
this.createDraft(data)
}, 500)
}
})
},
createProduct(content) {
sendChromeAPIMessage({
url: 'bg-visage-mms/product/draft/save',
needMallId: true,
mallId: this.form.targetMallId,
data: {
...content
}}).then((res) => {
if (res.errorCode == 1000000) {
Message.success("成功添加到草稿箱")
} else {
setTimeout(() => {
this.createProduct(content)
}, 500)
}
})
},
getSpecId(data) {
return sendChromeAPIMessage({
url: 'bg-anniston-mms/sku/spec/byName/queryOrAdd',
needMallId: true,
mallId: this.form.targetMallId,
data: {
parentSpecId: data.specKeyId,
specName: data.specValue
}}).then((res) => {
if (res.errorCode == 1000000) {
return res
} else {
this.getSpecId(data)
}
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,268 @@
<template>
<ai-list class="list" v-loading="isLoading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
<ai-title
slot="title"
title="待装箱发货列表"
isShowBottomBorder>
<template #rightBtn>
<div class="title-right">
<div>
<label style="width:90px">店铺</label>
<el-select v-model="mallId" @change="beforeGetList" 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>
</div>
</template>
</ai-title>
<template slot="content">
<ai-card title="数据明细" style="padding-bottom: 40px;">
<template #right>
<json-excel
:data="tableData"
:fields="jsonFields"
:before-generate = "startDownload"
name="待装箱发货单明细.xls"
worksheet="待装箱发货单明细">
<el-button type="primary">导出数据</el-button>
</json-excel>
</template>
<ai-table
:isShowPagination="false"
:tableData="tableData"
:col-configs="colConfigs"
:total="tableData.length"
height="500"
style="margin-top: 8px;"
@getList="() => {}">
</ai-table>
</ai-card>
</template>
</ai-list>
</template>
<script>
import {sendChromeAPIMessage} from '@/api/chromeApi'
import JsonExcel from 'vue-json-excel'
import {timestampToTime} from '@/utils/date'
import { Message } from 'element-ui'
export default {
name: 'WaitShippingList',
data () {
return {
isLoading: false,
list: [],
tableData: [],
mallId: '',
colConfigs: [
{ prop: 'subPurchaseOrderSn', label: '备货单号', align: 'left' },
{ prop: 'deliveryOrderSn', label: '发货单号', align: 'left' },
{ prop: 'productName', label: '商品名称', align: 'left' },
{ prop: 'productSkcId', label: 'SKC ID', align: 'left' },
{ prop: 'skcExtCode', label: 'SKC货号', align: 'left' },
{ prop: 'productSkuId', label: 'SKU ID', align: 'left' },
{ prop: 'skuExtCode', label: 'SKU货号', align: 'left' },
{ prop: 'specName', label: '属性集', align: 'left' },
{ prop: 'supplierPrice', label: '申报价格', align: 'left' },
{ prop: 'skuNum', label: '发货数量', align: 'left' },
{ prop: 'subWarehouseName', label: '收货仓库', align: 'left' },
{ prop: 'createTime', label: '创建时间', align: 'left' }
],
jsonFields: {
"备货单号": "subPurchaseOrderSn",
"发货单号": "deliveryOrderSn",
"商品名称": "productName",
"SKC ID": "productSkcId",
"SKC货号": "skcExtCode",
"SKU ID": "productSkuId",
"SKU货号": "skuExtCode",
"属性集": "specName",
"申报价格": "supplierPrice",
"发货数量": "skuNum",
"收货仓库": "subWarehouseName",
"创建时间": "createTime"
},
currentPage: 1,
packageNumber: 0,
skcIds: []
}
},
computed: {
},
components: {
JsonExcel
},
created () {
},
methods: {
changeDataType() {
},
beforeGetList() {
if (!this.mallId) {
Message.error("请先选择店铺")
return
}
this.currentPage = 1
this.list = []
this.$userCheck(this.mallId).then(() => {
this.isLoading = true
this.skcIds = []
this.getList()
}).catch((err) => {
this.isLoading = false
})
},
getList () {
sendChromeAPIMessage({
url: 'bgSongbird-api/supplier/deliverGoods/management/pageQueryDeliveryOrders',
needMallId: true,
mallId: this.mallId,
anti: true,
data: {
"pageNo": this.currentPage,
"pageSize": 100,
"sortType": 0,
"status": 0
}}).then((res) => {
if (res.errorCode == 1000000) {
for(let i = 0;i < res.result.list.length; i++) {
let item = res.result.list[i];
let data = {};
data.subWarehouseName = item.subWarehouseName
data.skcExtCode = item.skcExtCode
data.createTime = timestampToTime(item.deliveryOrderCreateTime)
data.productName = item.subPurchaseOrderBasicVO.productName,
data.productSkcId = item.productSkcId
data.deliveryOrderSn = item.deliveryOrderSn
data.subPurchaseOrderSn = item.subPurchaseOrderSn
if (this.skcIds.indexOf(item.productSkcId) == -1) {
this.skcIds.push(item.productSkcId)
}
for(let j = 0; j < item.packageDetailList.length; j++) {
let item1 = item.packageDetailList[j]
data = {...data,
productSkuId: item1.productSkuId,
skuNum: item1.skuNum}
this.list.push(data)
}
}
if (100 == res.result.list.length) {
this.currentPage ++
setTimeout(() => {
this.getList()
}, 1000)
} else {
this.getProductDetailList(0)
}
} else {
setTimeout(() => {
this.getList()
}, 1000)
// Message.error("【拼多多】" + res.errorMsg + ", 请重新尝试加载")
}
})
},
getProductDetailList(page) {
let productSkcIds = []
let i = page * 100
let j = 0
for (; i < this.skcIds.length; i++) {
productSkcIds.push(this.skcIds[i])
j ++
if (j == 100) break
}
if (productSkcIds.length == 0) {
this.isLoading = false
this.tableData = this.list
return
}
sendChromeAPIMessage({
url: 'bg-visage-mms/product/skc/pageQuery',
needMallId: true,
anti: true,
mallId: this.mallId,
data: {
"productSkcIds": productSkcIds,
"page": 1,
"pageSize": 100
}}).then((res) => {
if (res.errorCode == 1000000) {
for(let i = 0;i < res.result.pageItems.length; i++) {
let item = res.result.pageItems[i]
item.productSkuSummaries.map(temp1 => {
for (let j = 0; j < this.list.length; j++) {
if (this.list[j].productSkuId == temp1.productSkuId) {
this.list[j].skuExtCode = temp1.extCode
this.list[j].supplierPrice = (temp1.supplierPrice / 100).toFixed(2)
let specList = temp1.productSkuSpecList.map(temp3 => {
return temp3.specName
})
this.list[j].specName = specList.join(",")
}
}
})
}
this.getProductDetailList(page + 1)
} else {
setTimeout(() => {
this.getProductDetailList(page)
}, 200)
}
})
},
startDownload() {
this.$http.post('/api/malluser/info').then(res => {
if (res.code == 0) {
this.$store.commit('setUserInfo', res.data)
if (res.data.flag != 1) {
Message.error('您的账号未激活或已失效,请激活后使用')
this.$store.commit('setActiveDlgShow', true)
return;
}
}
})
}
}
}
</script>
<style scoped lang="scss">
.list {
.title-right {
display: flex;
align-items: center;
& > div:first-child {
margin-right: 20px;
}
}
::v-deep.ai-list {
.ai-list__content--right-wrapper {
background: transparent;
box-shadow: none;
padding: 0!important;
}
}
}
</style>

View File

@@ -61,6 +61,7 @@ import { Message } from 'element-ui'
list: [], list: [],
mallId: '', mallId: '',
colConfigs: [ colConfigs: [
{ prop: 'subPurchaseOrderSn', label: '备货单号', align: 'left' },
{ prop: 'productName', label: '商品名称', align: 'left' }, { prop: 'productName', label: '商品名称', align: 'left' },
{ prop: 'skcExtCode', label: '货号', align: 'left' }, { prop: 'skcExtCode', label: '货号', align: 'left' },
{ prop: 'productSkcId', label: 'SKC ID', align: 'left' }, { prop: 'productSkcId', label: 'SKC ID', align: 'left' },
@@ -71,9 +72,11 @@ import { Message } from 'element-ui'
{ prop: 'expressDeliverySn', label: '物流单号', align: 'left' }, { prop: 'expressDeliverySn', label: '物流单号', align: 'left' },
{ prop: 'deliveryOrderSn', label: '发货单号', align: 'left' }, { prop: 'deliveryOrderSn', label: '发货单号', align: 'left' },
{ prop: 'subWarehouseName', label: '收货仓库', align: 'left' }, { prop: 'subWarehouseName', label: '收货仓库', align: 'left' },
{ prop: 'deliverTime', label: '发货时间', align: 'left' },
{ prop: 'expectPickUpGoodsTime', label: '预约取货时间', align: 'left' } { prop: 'expectPickUpGoodsTime', label: '预约取货时间', align: 'left' }
], ],
jsonFields: { jsonFields: {
"备货单号": "subPurchaseOrderSn",
"商品名称": "productName", "商品名称": "productName",
"货号": "skcExtCode", "货号": "skcExtCode",
"SKC ID": "productSkcId", "SKC ID": "productSkcId",
@@ -84,6 +87,7 @@ import { Message } from 'element-ui'
"物流单号": "expressDeliverySn", "物流单号": "expressDeliverySn",
"发货单号": "deliveryOrderSn", "发货单号": "deliveryOrderSn",
"收货仓库": "subWarehouseName", "收货仓库": "subWarehouseName",
"发货时间": "deliverTime",
"预约取货时间": "expectPickUpGoodsTime" "预约取货时间": "expectPickUpGoodsTime"
}, },
@@ -138,13 +142,15 @@ import { Message } from 'element-ui'
data.expressDeliverySn = item.expressDeliverySn data.expressDeliverySn = item.expressDeliverySn
data.subWarehouseName = item.subWarehouseName data.subWarehouseName = item.subWarehouseName
data.expectPickUpGoodsTime = timestampToTime(item.expectPickUpGoodsTime) data.expectPickUpGoodsTime = timestampToTime(item.expectPickUpGoodsTime)
for(let j = 0;j < item.deliveryOrderList.length; j++) { for(let j = 0;j < item.deliveryOrderList.length; j++) {
let item1 = item.deliveryOrderList[j] let item1 = item.deliveryOrderList[j]
data = {...data, data = {...data,
subPurchaseOrderSn: item1.subPurchaseOrderSn,
deliveryOrderSn: item1.deliveryOrderSn, deliveryOrderSn: item1.deliveryOrderSn,
productName: item1.subPurchaseOrderBasicVO.productName, productName: item1.subPurchaseOrderBasicVO.productName,
skcExtCode: item1.subPurchaseOrderBasicVO.skcExtCode, skcExtCode: item1.subPurchaseOrderBasicVO.skcExtCode,
deliverTime: timestampToTime(item1.deliverTime),
productSkcId: item1.productSkcId} productSkcId: item1.productSkcId}
for(let k = 0; k < item1.packageDetailList.length; k++) { for(let k = 0; k < item1.packageDetailList.length; k++) {
@@ -162,15 +168,13 @@ import { Message } from 'element-ui'
}, 200 * i) }, 200 * i)
} }
} }
if (this.pageSize == res.result.deliveryOrderList.length) { if (100 == res.result.list.length) {
this.currentPage ++ this.currentPage ++
setTimeout(() => { setTimeout(() => {
this.getList() this.getList()
}, 1500) }, 1500)
} else { } else {
if (this.currentPage == 1 && res.result.list.length == 0) { this.isLoading = false
this.isLoading = false
}
} }
} else { } else {
setTimeout(() => { setTimeout(() => {