大调整

This commit is contained in:
liushiwei
2023-08-22 20:16:59 +08:00
parent f03d1ccf2e
commit 3bd2c7d246
12 changed files with 996 additions and 44 deletions

44
public/rules_1.json Normal file
View File

@@ -0,0 +1,44 @@
[
{
"id": 12,
"priority": 1,
"action": {
"type": "modifyHeaders",
"requestHeaders": [
{
"header": "Origin",
"operation": "set",
"value": "https://kuajing.pinduoduo.com"
},
{
"header": "Referer",
"operation": "set",
"value": "https://kuajing.pinduoduo.com/main/order-manage"
},
{
"header": "Sec-Fetch-Site",
"operation": "set",
"value": "same-origin"
},
{
"header": "Sec-Ch-Ua",
"operation": "set",
"value": "\"Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"115\", \"Chromium\";v=\"115\""
},
{
"header": "Sec-Ch-Ua-Mobile",
"operation": "set",
"value": "?0"
},
{
"header": "Sec-Ch-Ua-Platform",
"operation": "set",
"value": "Windows"
}
]
},
"condition": {
"urlFilter": "joinDeliveryGoodsOrderPlatform"
}
}
]

View File

@@ -46,6 +46,23 @@ chrome.action.onClicked.addListener(function () {
});
});
chrome.webRequest.onSendHeaders.addListener(details => {
if (details.url && (details.url.indexOf('joinDeliveryGoodsOrderPlatform') != -1)) {
details.requestHeaders.push({
name: 'Referer',
value: 'https://kuajing.pinduoduo.com/main/order-manage'
})
for (let i = 0 ; i < details.requestHeaders.length; i++) {
if (details.requestHeaders[i].name == 'Origin') {
details.requestHeaders[i].value = 'https://kuajing.pinduoduo.com'
break;
}
}
}
},
{urls: ["<all_urls>"]},["requestHeaders", "extraHeaders"]);
function getCookie() {
const url = new URL("https://kuajing.pinduoduo.com/");
let cStr = '';

View File

@@ -21,8 +21,19 @@
"notifications",
"tabs",
"scripting",
"webRequest",
"declarativeNetRequest",
"declarativeNetRequestWithHostAccess",
"declarativeNetRequestFeedback",
"activeTab"
],
"declarative_net_request": {
"rule_resources": [{
"id": "1",
"enabled": true,
"path": "rules_1.json"
}]
},
"content_scripts": [
{
"matches": [

View File

@@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "TEMU助手",
"description": "TEMU助手 - 自动化提高生产效率",
"version": "2.1.0",
"version": "2.2.0",
"background": {
"service_worker": "/background.js"
},
@@ -18,7 +18,11 @@
],
"permissions": [
"cookies",
"notifications"
"notifications",
"declarativeNetRequest",
"declarativeNetRequestWithHostAccess",
"declarativeNetRequestFeedback",
"webRequest"
],
"content_scripts": [
{

View File

@@ -28,23 +28,37 @@ const router = new VueRouter({
{
path: 'normalSendGoods',
name: 'NormalSendGoods',
component: () => import('../view/NormalSendGoods.vue')
component: () => import('../view/shipping/NormalSendGoods.vue')
},
{
path: 'shippingList',
name: 'shippingList',
component: () => import('../view/shipping/ShippingList.vue')
},
{
path: 'waitShippingList',
name: 'waitShippingList',
component: () => import('../view/shipping/WaitShippingList.vue')
},
{
path: 'copyProduct',
name: 'copyProduct',
component: () => import('../view/product/CopyProduct.vue')
},
{
path: 'message',
name: 'message',
component: () => import('../view/Message.vue')
},
{
path: 'copyProduct',
name: 'copyProduct',
component: () => import('../view/CopyProduct.vue')
},
{
path: 'saleData',
name: 'saleData',
component: () => import('../view/ExportSaleData.vue')
},
// {
// path: 'statistics',
// name: 'statistics',

View File

@@ -12,3 +12,13 @@ export function timestampToTime(timestamp) {
let s = (date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds());
return Y + M + D + h + m + s;
}
export function formatDate(date) {
let Y = date.getFullYear() + "-";
let M =
(date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1) + "-";
let D = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate());
return Y + M + D;
}

View File

@@ -8,7 +8,7 @@
<div class="title-right">
<div>
<label style="width:90px">统计类型</label>
<el-select v-model="type" @change="beforeGetList" placeholder="请选择" size="small">
<el-select v-model="type" @change="changeDataType" placeholder="请选择" size="small">
<el-option
key="0"
label="销售数据"
@@ -35,14 +35,14 @@
</div>
</template>
</ai-title>
<template slot="content">
<div class="top" v-if="type === '0'">
<template slot="content" v-if="type === '0'">
<div class="top">
<div class="item">
<h2>销量</h2>
<h2>销量</h2>
<p>{{ todayTotal }}</p>
</div>
<div class="item">
<h2>销售额</h2>
<h2>销售额</h2>
<p>{{ todayMoney }}</p>
</div>
<div class="item">
@@ -53,16 +53,25 @@
<h2>库存总额</h2>
<p>{{ inventoryMoeny }}</p>
</div>
<div class="item">
<h2>已收货总量</h2>
<p>{{ deliveryTotal }}</p>
</div>
<div class="item">
<h2>已收货总货值</h2>
<p>{{ deliveryMoeny }}</p>
</div>
</div>
<ai-card title="销售数据明细" style="padding-bottom: 40px;">
<ai-card title="数据明细" style="padding-bottom: 40px;">
<template #right>
<json-excel
:data="list"
v-if="type === '0'"
:fields="jsonFields"
:before-generate = "startDownload"
name="销售数据.xls"
worksheet="销售统计">
<el-button type="primary">导出销售数据</el-button>
<el-button type="primary">导出数据</el-button>
</json-excel>
</template>
<ai-table
@@ -75,12 +84,36 @@
</ai-table>
</ai-card>
</template>
<template slot="content" v-if="type === '1'">
<ai-card title="数据明细" style="padding-bottom: 40px;">
<template #right>
<json-excel
v-if="type === '1'"
:data="last30Daylist"
:fields="last30DaysJsonFields"
:before-generate = "startDownload"
name="近30天销售数据.xls"
worksheet="近30天销售统计">
<el-button type="primary">导出数据</el-button>
</json-excel>
</template>
<ai-table
:isShowPagination="false"
:tableData="last30Daylist"
:col-configs="col30DaysConfigs"
:total="last30Daylist.length"
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 {formatDate} from '@/utils/date'
import { Message } from 'element-ui'
export default {
@@ -89,6 +122,7 @@ import { Message } from 'element-ui'
data () {
return {
list: [],
last30Daylist: [],
mallId: '',
type: '0',
isLoading: false,
@@ -98,6 +132,11 @@ import { Message } from 'element-ui'
todayMoney: 0.0,
inventoryTotal: 0,
inventoryMoeny: 0.0,
deliveryTotal: 0,
deliveryMoeny: 0.0,
allProductList: [],
startDate: '',
endDate: '',
jsonFields: {
"商品名称": "productName",
"SPU": "productId",
@@ -194,7 +233,11 @@ import { Message } from 'element-ui'
prop: 'warehouseInventoryNum',
label: '仓内可用库存',
align: 'center',
fixed: "right"
fixed: "right",
sortable: true,
'sort-method': (a, b) => {
return a.warehouseInventoryNum - b.warehouseInventoryNum
}
},
{
prop: 'productTotalPrice',
@@ -208,6 +251,75 @@ import { Message } from 'element-ui'
},
]
},
col30DaysConfigs () {
let config = [
{
prop: 'productName',
label: '商品名称',
"show-overflow-tooltip": true,
width: '300px',
align: 'left',
fixed: 'left'
},
{
prop: 'productId',
label: 'SPU',
width: '120px',
align: 'center',
fixed: 'left'
},
{
prop: 'productSkcId',
label: 'SKC',
width: '120px',
align: 'center',
fixed: 'left'
},
{
prop: 'productSkuId',
label: 'SKU ID',
width: '120px',
align: 'center',
fixed: 'left'
}
]
let date = new Date()
date.setDate(date.getDate())
for (let i = 0; i < 30; i++) {
date.setDate(date.getDate() - 1)
let dateStr = formatDate(date)
config.push({
prop: dateStr,
label: dateStr,
width: '100px',
align: 'center',
sortable: true,
'sort-method': (a, b) => {
return new Number(a[dateStr]) - new Number(b[dateStr])
}})
}
return config
},
last30DaysJsonFields () {
let jsonFields = {
"商品名称": "productName",
"SPU": "productId",
"SKC": "productSkcId",
"SKU ID": "productSkuId"
}
let date = new Date()
date.setDate(date.getDate() )
for (let i = 0; i < 30; i++) {
date.setDate(date.getDate() - 1)
let dateStr = formatDate(date)
jsonFields[dateStr] = dateStr
}
return jsonFields
}
},
@@ -216,9 +328,17 @@ import { Message } from 'element-ui'
},
created () {
let date = new Date()
date.setDate(date.getDate() - 30)
this.startDate = formatDate(date)
date.setDate(date.getDate() + 29)
this.endDate = formatDate(date)
},
methods: {
changeDataType() {
},
beforeGetList() {
this.list = []
this.currentPage = 1
@@ -226,6 +346,7 @@ import { Message } from 'element-ui'
this.todayTotal = 0
this.inventoryMoeny = 0.0
this.inventoryTotal = 0
this.allProductList = []
if (!this.mallId) {
Message.error("请先选择店铺")
@@ -233,11 +354,30 @@ import { Message } from 'element-ui'
}
this.isLoading = true
this.$userCheck(this.mallId).then(() => {
this.getAllProductList()
this.getList()
}).catch((err) => {
console.log(err)
this.isLoading = false
})
},
getAllProductList() {
this.$http.post('/api/deliveryOrder/totalDelivery',null, {
params: {mallId: this.mallId}
}).then(res => {
if (res.code === 0) {
this.deliveryTotal = res.data
}
})
this.$http.post('/api/deliveryOrder/getAllProductList', null, {
params: {mallId: this.mallId}
}).then(res => {
if (res.code == 0) {
this.allProductList = res.data
}
})
},
getList () {
sendChromeAPIMessage({
url: 'marvel-mms/cn/api/kiana/venom/sales/management/list',
@@ -265,9 +405,19 @@ import { Message } from 'element-ui'
this.todayTotal += item.skuQuantityDetailList[j].todaySaleVolume
this.todayMoney += new Number(((item.skuQuantityDetailList[j].supplierPrice / 100) * item.skuQuantityDetailList[j].todaySaleVolume).toFixed(2))
this.todayMoney = new Number(this.todayMoney.toFixed(2))
this.inventoryTotal += item.skuQuantityDetailList[j].inventoryNumInfo.warehouseInventoryNum
this.inventoryMoeny += new Number(((item.skuQuantityDetailList[j].supplierPrice / 100) * item.skuQuantityDetailList[j].inventoryNumInfo.warehouseInventoryNum).toFixed(2))
this.inventoryMoeny = new Number(this.inventoryMoeny.toFixed(2))
this.list.push(data);
// 计算已发货货值
for(let k = 0; k < this.allProductList.length; k++) {
if (this.allProductList[k].product_sku_id == data.productSkuId) {
this.deliveryMoeny += (item.skuQuantityDetailList[j].supplierPrice / 100) * this.allProductList[k].product_sku_number
this.deliveryMoeny = new Number(this.deliveryMoeny.toFixed(2))
}
}
}
}
if (this.pageSize == res.result.subOrderList.length) {
@@ -278,6 +428,24 @@ import { Message } from 'element-ui'
} else {
this.isLoading = false
Message.success('销售数据加载完成,可进行导出')
this.last30Daylist = this.list.map(item => {
let temp = {
productName: item.productName,
productId: item.productId,
productSkcId: item.productSkcId,
productSkuId: item.productSkuId
}
let date = new Date()
date.setDate(date.getDate() - 31)
for (let i = 0; i < 30; i++) {
date.setDate(date.getDate() + 1)
let dateStr = formatDate(date)
temp[dateStr] = 0
}
return temp
})
this.getSkuDetailList()
}
} else {
setTimeout(() => {
@@ -289,6 +457,32 @@ import { Message } from 'element-ui'
this.isLoading = false
})
},
getSkuDetailList () {
let skuIds = this.list.map(item => {
return item.productSkuId
})
sendChromeAPIMessage({
url: 'oms/bg/venom/api/supplier/sales/management/querySkuSalesNumber',
needMallId: true,
mallId: this.mallId,
data: {
"productSkuIds": skuIds,
"startDate": this.startDate,
"endDate": this.endDate
}}).then((res) => {
if (res.errorCode == 1000000) {
for (let i = 0; i < res.result.length; i++) {
for (let j = 0; j < this.last30Daylist.length; j++) {
if (this.last30Daylist[j].productSkuId == res.result[i].prodSkuId) {
this.last30Daylist[j][res.result[i].date] = res.result[i].salesNumber
break
}
}
}
}
})
},
startDownload() {
this.$http.post('/api/malluser/info').then(res => {
if (res.code == 0) {

View File

@@ -40,14 +40,24 @@
<i class="el-icon-monitor"></i>
<span slot="title">工作台</span>
</el-menu-item>
<el-menu-item index="/normalSendGoods">
<i class="el-icon-shopping-cart-2"></i>
<span slot="title">普通备货单</span>
</el-menu-item>
<el-menu-item index="/copyProduct">
<i class="el-icon-document-copy"></i>
<span slot="title">商品复制</span>
</el-menu-item>
<el-submenu index="/normalSendGoods">
<template slot="title">
<i class="el-icon-shopping-cart-2"></i>
<span slot="title">备货单管理</span>
</template>
<el-menu-item index="/normalSendGoods">抢仓发货</el-menu-item>
<el-menu-item index="/waitShippingList">待收货发货单</el-menu-item>
<el-menu-item index="/shippingList">已收货发货单</el-menu-item>
</el-submenu>
<el-submenu index="/copyProduct">
<template slot="title">
<i class="el-icon-goods"></i>
<span slot="title">商品管理</span>
</template>
<el-menu-item index="/copyProduct">商品复制</el-menu-item>
</el-submenu>
<el-menu-item index="/saleData">
<i class="el-icon-s-data"></i>
<span slot="title">销售数据</span>

View File

@@ -128,7 +128,7 @@ import {transform} from '@/utils/product'
import { Message } from 'element-ui'
export default {
name: 'List',
name: 'CopyProduct',
data () {
return {

View File

@@ -3,7 +3,7 @@
<ai-list class="list">
<ai-title
slot="title"
title="普通备货单"
title="抢仓发货"
tips="请先在当前浏览器登录“拼多多跨境卖家中心”,期间保持登录状态"
isShowBottomBorder>
</ai-title>
@@ -19,7 +19,7 @@
<!--<el-button type="primary" :disabled="isBegin" @click="isShow = true">添加备货单</el-button>
<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="robDlgShow = true">开始抢仓</el-button>
<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">
@@ -198,13 +198,14 @@
:visible.sync="robDlgShow"
:close-on-click-modal="false"
customFooter
width="600px">
height="500px"
width="700px">
<el-alert
title="抢仓速度 = 频率 + 0~变动值之间的随机数如频率设置为1.5秒变动值为500毫秒则抢仓速度为1.5秒~2秒。"
type="success"
:closable="false">
</el-alert>
<el-form :model="robForm" ref="robForm" label-width="120px" class="form">
<el-form :model="robForm" ref="robForm" label-width="180px" class="form">
<el-form-item
prop="step"
label="频率:"
@@ -217,6 +218,25 @@
:rules="[{ required: true, message: '请输入变动值', trigger: 'blur' }]">
<el-input size="small" placeholder="请输入变动值" type="number" v-model="robForm.randomValue"></el-input>
</el-form-item>
<el-form-item
prop="isCreateDeliveryBill"
label="是否创建发货单:"
:rules="[{ required: true, message: '请选择是否创建发货单', trigger: 'blur' }]">
<el-radio-group v-model="robForm.isCreateDeliveryBill" size="medium">
<el-radio :label="false"></el-radio>
<el-radio :label="true"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
prop="isModifyMaxNum"
label="是否修改为最大发货数:"
:rules="[{ required: true, message: '请选择是否修改为最大发货数', trigger: 'blur' }]">
<el-radio-group :disabled="!robForm.isCreateDeliveryBill" v-model="robForm.isModifyMaxNum" size="medium">
<el-radio :label="false"></el-radio>
<el-radio :label="true"></el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@@ -274,13 +294,14 @@
currentPage: 1,
robForm: {
step: "1000",
randomValue: 1000
randomValue: 1000,
isCreateDeliveryBill: false,
isModifyMaxNum: false
},
timer: [],
loadMallIndex: 0,
loadMode: 0, // 01
robMode: 0, // 01
isCreateDeliveryBill: false,
//
networkErrorCount: 0,
@@ -360,6 +381,13 @@
this.loadAll()
}
},
beginRobConfirm() {
if (this.choosedList.length <= 0) {
Message.error('请先添加备货单');
return;
}
this.robDlgShow = true
},
beforeBegin() {
this.$refs.robForm.validate((valid) => {
if (valid) {
@@ -453,10 +481,6 @@
return;
}
if (this.choosedList.length <= 0) {
Message.error('请添加备货单');
return;
}
this.choosedSnMallList = this.choosedList.map(item => {
return {sn: item.subPurchaseOrderSn, mallId: item.mallId}
})
@@ -532,7 +556,7 @@
}
//
if (this.isCreateDeliveryBill) {
if (this.robForm.isCreateDeliveryBill) {
this.createDeliveryBill(sn, mallId)
}
} else {
@@ -566,6 +590,7 @@
sendChromeAPIMessage({
url: 'bgSongbird-api/supplier/deliverGoods/platform/pageQuerySubPurchaseOrder',
needMallId: true,
anti: true,
mallId: mallId,
data: {
"pageNo": 1,
@@ -575,17 +600,35 @@
]
}}).then((res) => {
if (res.errorCode == 1000000) {
if (res.result.list.length == 0) {
setTimeout(() => { this.createDeliveryBill(sn, mallId)}, 1000)
return
}
let data = res.result.list[0]
let deliverOrderDetailInfos = data.orderDetailVOList.map(item => {
return {
productSkuId: item.productSkuId,
deliverSkuNum: item.productSkuPurchaseQuantity
if (this.robForm.isModifyMaxNum) {
return {
productSkuId: item.productSkuId,
deliverSkuNum: item.skuDeliveryQuantityMaxLimit
}
} else {
return {
productSkuId: item.productSkuId,
deliverSkuNum: item.productSkuPurchaseQuantity
}
}
})
let packageDetailSaveInfos = data.orderDetailVOList.map(item => {
return {
productSkuId: item.productSkuId,
skuNum: item.productSkuPurchaseQuantity
if (this.robForm.isModifyMaxNum) {
return {
productSkuId: item.productSkuId,
skuNum: item.skuDeliveryQuantityMaxLimit
}
} else {
return {
productSkuId: item.productSkuId,
skuNum: item.productSkuPurchaseQuantity
}
}
})
let packageInfos = []
@@ -605,9 +648,23 @@
subWarehouseId: data.subPurchaseOrderBasicVO.subWarehouseId
})
console.log(deliveryOrderCreateGroupList)
this.createDeliveryOrder(mallId, deliveryOrderCreateGroupList)
} else {
// setTimeout(this.createDeliveryBillFun(sn, mallId), 1000)
setTimeout(() => { this.createDeliveryBill(sn, mallId)}, 1000)
}
})
},
createDeliveryOrder(mallId, data) {
sendChromeAPIMessage({
url: 'bgSongbird-api/supplier/deliverGoods/platform/createDeliveryOrderGroupSimpleByAddress',
needMallId: true,
anti: true,
mallId: mallId,
data: {deliveryOrderCreateGroupList: data}}).then((res) => {
if (res.errorCode == 1000000) {
console.log(res)
} else {
setTimeout(() => { this.createDeliveryOrder(mallId, data)}, 1000)
}
})
},

View File

@@ -0,0 +1,341 @@
<template>
<ai-list class="list" v-loading="isLoading">
<ai-title
slot="title"
title="已收货发货单列表"
isShowBottomBorder>
<template #rightBtn>
<div class="title-right">
<div>
<label style="width:90px">店铺</label>
<el-select v-model="search.mallId" @change="changeMallId" 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>
<el-button type="button" :class="'el-button el-button--primary'" @click="beginSync">同步</el-button>
</div>
</div>
</template>
</ai-title>
<template slot="content">
<div class="top">
<div class="item">
<h2><span><i class="el-icon-time"></i></span>最后一次同步时间</h2>
<p>{{ lastSyncDate }}</p>
</div>
<div class="item">
<h2>发货总量</h2>
<p>{{ totalDelivery }}</p>
</div>
</div>
<ai-card title="数据明细" style="padding-bottom: 40px;">
<!--<template #right>
<json-excel
:data="last30Daylist"
:fields="last30DaysJsonFields"
:before-generate = "startDownload"
name="近30天销售数据.xls"
worksheet="近30天销售统计">
<el-button type="primary">导出数据</el-button>
</json-excel>
</template>-->
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 8px;"
:current.sync="search.current" :size.sync="search.size"
@getList="getDeliveryOrderList">
</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: 'ShippingList',
data () {
return {
isLoading: false,
list: [],
colConfigs: [
{ prop: 'productName', label: '商品名称', align: 'left' },
{ prop: 'skcExtCode', label: '货号', align: 'left' },
{ prop: 'skcId', label: 'SKC ID', align: 'left' },
{ prop: 'logisticName', label: '物流公司', align: 'left' },
{ prop: 'logisticNumber', label: '物流单号', align: 'left' },
{ prop: 'totalNumber', label: '总件数', align: 'left' },
{ prop: 'deliveryTime', label: '发货时间', width: '180px', fixed: 'right'}
],
currentPage: 1,
pageSize: 100,
tableData: [],
total: 0,
search: {
current: 1,
size: 10,
mallId: ''
},
packageNumber: 0,
lastSyncDate: '',
totalDelivery: 0,
lastDeliveryTimestamp: 0
}
},
computed: {
},
/*components: {
JsonExcel
},*/
created () {
},
methods: {
changeDataType() {
},
getDeliveryOrderList () {
this.$http.post('/api/deliveryOrder/page',null,{
params: {
...this.search
}
}).then(res => {
this.tableData = res.data.records
this.total = res.data.total
})
},
changeMallId() {
if (!this.search.mallId) {
Message.error("请先选择店铺")
return
}
this.search.current = 1
this.tableData = []
this.getDeliveryOrderList()
this.getInfo()
},
getInfo() {
this.$http.post('/api/deliveryRecord/getLastSyncTime',null, {
params: {mallId: this.search.mallId}
}).then(res => {
if (res.code === 0) {
this.lastSyncDate = res.data?.lastSyncTime
}
})
this.$http.post('/api/deliveryOrder/totalDelivery',null, {
params: {mallId: this.search.mallId}
}).then(res => {
if (res.code === 0) {
this.totalDelivery = res.data
}
})
},
beginSync() {
this.isLoading = true
this.currentPage = 1
this.packageNumber = 0
this.$http.post('/api/deliveryRecord/start',null, {
params: {mallId: this.search.mallId}
}).then(res => {
if (res.code === 0) {
this.lastDeliveryTimestamp = res.data?.lastDeliveryTime
this.getList()
} else {
this.isLoading = false
Message.error("同步发货单失败")
}
}).catch(() => {
this.isLoading = false
Message.error("同步发货单失败")
})
},
end() {
this.$http.post('/api/deliveryRecord/end',null, {
params: {mallId: this.search.mallId}
}).then(res => {
if (res.code === 0) {
this.search.current = 1
this.getDeliveryOrderList()
this.getInfo()
}
})
},
getList () {
let data = {
"pageNo": this.currentPage,
"pageSize": this.pageSize,
"status": 2
}
if (this.lastDeliveryTimestamp) {
data.deliverTimeFrom = this.lastDeliveryTimestamp
data.deliverTimeTo = Date.now() / 1000
}
sendChromeAPIMessage({
url: 'bgSongbird-api/supplier/deliverGoods/management/pageQueryDeliveryOrders',
needMallId: true,
mallId: this.search.mallId,
anti: true,
data: data}).then((res) => {
if (res.errorCode == 1000000) {
let list = []
for(let i = 0;i < res.result.list.length; i++) {
let item = res.result.list[i];
let data = {};
data.id = item.deliveryOrderSn
data.productName = item.subPurchaseOrderBasicVO.productName;
data.mallId = this.search.mallId
data.skcId = item.subPurchaseOrderBasicVO.productSkcId;
data.skcExtCode = item.subPurchaseOrderBasicVO.skcExtCode;
data.logisticName = item.expressCompany
data.logisticNumber = item.expressDeliverySn
data.totalNumber = item.deliverSkcNum
data.deliveryTime = timestampToTime(item.deliverTime)
list.push(data)
this.packageNumber = this.packageNumber + item.receivePackageNum
setTimeout(() => {
this.getSkuDetailList(data.id)
}, 200 * i)
}
this.$http.post('/api/deliveryOrder/add',list).then(res => {
console.log(res)
})
if (this.pageSize == res.result.list.length) {
this.currentPage ++
setTimeout(() => {
this.getList()
}, 1500)
} else {
if (this.currentPage == 1 && res.result.list.length == 0) {
this.isLoading = false
}
this.end()
}
} else {
setTimeout(() => {
this.getList()
}, 1500)
}
}).catch(() => {
this.isLoading = false
})
},
getSkuDetailList(sn) {
sendChromeAPIMessage({
url: 'bgSongbird-api/supplier/deliverGoods/management/queryDeliveryOrderPackageDetailInfo',
needMallId: true,
mallId: this.search.mallId,
anti: true,
data: {deliveryOrderSn: sn}}).then((res) => {
if (res.errorCode == 1000000) {
let list = []
for(let i = 0;i < res.result.deliveryOrderDetails.length; i++) {
let item = res.result.deliveryOrderDetails[i]
let data = {}
data.deliveryOrderId = sn
data.productSkuId = item.productSkuId
data.productSkuNumber = item.deliverSkuNum
list.push(data)
}
this.packageNumber = this.packageNumber - res.result.deliveryOrderDetails.length
if (this.packageNumber < 5) this.isLoading = false
this.$http.post('/api/deliveryOrderDetail/add',list)
} else {
setTimeout(() => {
this.getSkuDetailList(sn)
}, 200)
}
})
}
}
}
</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;
}
}
.top {
display: flex;
justify-content: space-between;
margin-bottom: 24px;
.item {
flex: 1;
margin-right: 20px;
padding: 16px 24px;
background: #FFF;
box-shadow: 0px 4px 6px -2px rgba(15, 15, 21, 0.15);
border-radius: 4px;
&:last-child {
margin-right: 0;
}
&:nth-of-type(1) {
color: #2266ff;
}
&:nth-of-type(2) {
color: #f8b426;
}
&:nth-of-type(3) {
color: #21aa99;
}
&:nth-of-type(4) {
color: #F46;
}
&:nth-of-type(5) {
color: #11A265;
}
h2 {
margin-bottom: 30px;
font-size: 16px;
color: #999;
}
p {
font-weight: 600;
font-size: 28px;
}
}
}
}
</style>

View File

@@ -0,0 +1,250 @@
<template>
<ai-list class="list" v-loading="isLoading">
<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="list"
:fields="jsonFields"
:before-generate = "startDownload"
name="待收货发货单明细.xls"
worksheet="待收货发货单明细">
<el-button type="primary">导出数据</el-button>
</json-excel>
</template>
<ai-table
:isShowPagination="false"
:tableData="list"
:col-configs="colConfigs"
:total="list.length"
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: [],
mallId: '',
colConfigs: [
{ prop: 'productName', label: '商品名称', align: 'left' },
{ prop: 'skcExtCode', label: '货号', align: 'left' },
{ prop: 'productSkcId', label: 'SKC ID', align: 'left' },
{ prop: 'productSkuId', label: 'SKU ID', align: 'left' },
{ prop: 'specName', label: '商品属性', align: 'left' },
{ prop: 'skuNum', label: '发货件数', align: 'left' },
{ prop: 'expressCompany', label: '物流公司', align: 'left' },
{ prop: 'expressDeliverySn', label: '物流单号', align: 'left' },
{ prop: 'deliveryOrderSn', label: '发货单号', align: 'left' },
{ prop: 'subWarehouseName', label: '收货仓库', align: 'left' },
{ prop: 'expectPickUpGoodsTime', label: '预约取货时间', align: 'left' }
],
jsonFields: {
"商品名称": "productName",
"货号": "skcExtCode",
"SKC ID": "productSkcId",
"SKU ID": "productSkuId",
"商品属性": "specName",
"发货件数": "skuNum",
"物流公司": "expressCompany",
"物流单号": "expressDeliverySn",
"发货单号": "deliveryOrderSn",
"收货仓库": "subWarehouseName",
"预约取货时间": "expectPickUpGoodsTime"
},
currentPage: 1,
packageNumber: 0
}
},
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.getList()
}).catch((err) => {
this.isLoading = false
})
},
getList () {
sendChromeAPIMessage({
url: 'bgSongbird-api/supplier/deliverGoods/management/pageQueryDeliveryBatch',
needMallId: true,
mallId: this.mallId,
data: {
"pageNo": this.currentPage,
"pageSize": 100,
"status": 1
}}).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.expressCompany = item.expressCompany
data.expressDeliverySn = item.expressDeliverySn
data.subWarehouseName = item.subWarehouseName
data.expectPickUpGoodsTime = timestampToTime(item.expectPickUpGoodsTime)
for(let j = 0;j < item.deliveryOrderList.length; j++) {
let item1 = item.deliveryOrderList[j]
data = {...data,
deliveryOrderSn: item1.deliveryOrderSn,
productName: item1.subPurchaseOrderBasicVO.productName,
skcExtCode: item1.subPurchaseOrderBasicVO.skcExtCode,
productSkcId: item1.productSkcId}
for(let k = 0; k < item1.packageDetailList.length; k++) {
data = {...data,
productSkuId: item1.packageDetailList[k].productSkuId,
specName: '',
skuNum: item1.packageDetailList[k].skuNum}
this.list.push(data)
}
this.packageNumber = this.packageNumber + item.receivePackageNum
setTimeout(() => {
this.getSkuDetailList(item1.deliveryOrderSn)
}, 200 * i)
}
}
if (this.pageSize == res.result.deliveryOrderList.length) {
this.currentPage ++
setTimeout(() => {
this.getList()
}, 1500)
} else {
if (this.currentPage == 1 && res.result.list.length == 0) {
this.isLoading = false
}
}
} else {
setTimeout(() => {
this.getList()
}, 1500)
// Message.error("【拼多多】" + res.errorMsg + ", 请重新尝试加载")
}
}).catch(() => {
this.isLoading = false
})
},
getSkuDetailList(sn) {
sendChromeAPIMessage({
url: 'bgSongbird-api/supplier/deliverGoods/management/queryDeliveryOrderPackageDetailInfo',
needMallId: true,
mallId: this.mallId,
anti: true,
data: {deliveryOrderSn: sn}}).then((res) => {
if (res.errorCode == 1000000) {
for(let i = 0;i < res.result.deliveryOrderDetails.length; i++) {
let item = res.result.deliveryOrderDetails[i]
let specArr = item.secondarySpecVOList.map(item => {
return item.specName
})
let spec = specArr.join(',')
for(let j = 0; j < this.list.length; j++) {
if (this.list[j].productSkuId == item.productSkuId) {
this.list[j].specName = spec
}
}
}
this.packageNumber = this.packageNumber - res.result.deliveryOrderDetails.length
if (this.packageNumber < 5) this.isLoading = false
} else {
setTimeout(() => {
this.getSkuDetailList(sn)
}, 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>