This commit is contained in:
liushiwei
2024-05-18 16:06:44 +08:00
parent 98fa8fc150
commit 2e1a84681d
18 changed files with 7445 additions and 7664 deletions

24
public/rules_5.json Normal file
View File

@@ -0,0 +1,24 @@
[
{
"id": 16,
"priority": 1,
"action": {
"type": "modifyHeaders",
"requestHeaders": [
{
"header": "Origin",
"operation": "set",
"value": "https://sso.geiwohuo.com/"
},
{
"header": "Referer",
"operation": "set",
"value": "https://sso.geiwohuo.com/"
}
]
},
"condition": {
"urlFilter": "||sso.geiwohuo.com"
}
}
]

29
public/rules_6.json Normal file
View File

@@ -0,0 +1,29 @@
[
{
"id": 17,
"priority": 1,
"action": {
"type": "modifyHeaders",
"requestHeaders": [
{
"header": "Origin",
"operation": "set",
"value": "https://csp.aliexpress.com"
},
{
"header": "Referer",
"operation": "set",
"value": "https://csp.aliexpress.com/"
},
{
"header": "Sec-Fetch-Site",
"operation": "set",
"value": "same-site"
}
]
},
"condition": {
"urlFilter": "||aliexpress.com"
}
}
]

View File

@@ -68,6 +68,19 @@ export async function sendSheinAPIMessage(message) {
})
}
/**
* 向Chrome发送消息
* @param message 消息
*/
export async function sendGeiwohuoAPIMessage(message) {
message.type = 'geiwohuoApi'
message.url = "https://sso.geiwohuo.com/" + message.url;
return new Promise((resolve) => {
// @ts-ignore
chrome.runtime.sendMessage(message, resolve)
})
}
/**
* 向Chrome发送消息
* @param message 消息
@@ -86,6 +99,9 @@ export function sendChromeNotification(message) {
*/
export function sendAliexpressAPIMessage(message) {
message.type = 'aliexpress'
if (!message.url.startsWith('http')) {
message.url = "https://seller-acs.aliexpress.com/" + message.url;
}
const {mtopConfig = {appKey: "12574478"}} = window
message.appKey = message.appKey || mtopConfig.appKey
return new Promise((resolve) => {

View File

@@ -144,7 +144,11 @@ export default {
}
this.selected = item
this.$http.post("/api/order/createOrder", null, {
params: {priceConfigId: item.id}
params: {
priceConfigId: item.id,
mallName: vipForm.mallName,
mallId: vipForm.mallId
}
}).then(res => {
if (res?.data?.id) {
return res.data.id

View File

@@ -172,6 +172,20 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
resolve(res.json());
});
}).then(sendResponse);
} else if (request.type == 'geiwohuoApi') {
new Promise((resolve) => {
let headers = {};
headers['Content-Type'] = 'application/json';
headers['X-Req-Zone-Id'] = 'Asia/Shanghai';
headers['X-Lt-Language'] = 'CN';
Promise.resolve().then(() => fetch(request.url, {
'headers': headers, 'method': request.method, 'referrerPolicy': 'no-referrer', 'credentials': 'include', 'body': JSON.stringify(request.data), 'mode': 'cors'
})).then((res) => {
resolve(res.json());
}).catch(() => {
resolve({success: false, errorCode: -1})
});
}).then(sendResponse);
} else if (request.type == 'notify') {
chrome.notifications.create("" + Math.random(), {
type: "basic", title: "TEMU助手", message: "您店铺【" + request.mallName + "】的商品【" + request.productName + "】成功加入发货台,请尽快处理", iconUrl: "./icons/48.png"

View File

@@ -20,7 +20,8 @@
"*://*.aliexpress.com/",
"*://*.alicdn.com/",
"*://*.amazon.com/",
"*://*.shein.com/"
"*://*.shein.com/",
"*://*.geiwohuo.com/"
],
"permissions": [
"cookies",
@@ -42,6 +43,14 @@
"id": "3",
"enabled": true,
"path": "rules_3.json"
},{
"id": "5",
"enabled": true,
"path": "rules_5.json"
},{
"id": "6",
"enabled": true,
"path": "rules_6.json"
}]
},
"content_scripts": [

View File

@@ -20,7 +20,8 @@
"*://*.aliexpress.com/",
"*://*.alicdn.com/",
"*://*.amazon.com/",
"*://*.shein.com/"
"*://*.shein.com/",
"*://*.geiwohuo.com/"
],
"permissions": [
"cookies",
@@ -46,6 +47,10 @@
"id": "4",
"enabled": true,
"path": "rules_4.json"
},{
"id": "5",
"enabled": true,
"path": "rules_5.json"
}]
},
"content_scripts": [

View File

@@ -70,12 +70,26 @@ const router = new VueRouter({
name: 'returnDetail',
component: () => import('../view/stock/ReturnDetail.vue')
},
{
path: 'productList',
name: 'productList',
component: () => import('../view/product/ProductList.vue')
},
{
path: 'copyProduct',
name: 'copyProduct',
component: () => import('../view/product/CopyProduct.vue')
},
{
path: 'copyProductShein',
name: 'copyProductShein',
component: () => import('../view/product/CopyProductShein.vue')
},
{
path: 'copyProductAliExpress',
name: 'copyProductAliExpress',
component: () => import('../view/product/CopyProductAliExpress.vue')
},
{
path: 'niubiCopy',
name: 'niubiCopy',
@@ -148,6 +162,11 @@ const router = new VueRouter({
name: 'saleData',
component: () => import('../view/sale/ExportSaleData.vue')
},
{
path: 'saleDataShein',
name: 'saleDataShein',
component: () => import('../view/sale/ExportSaleDataShein.vue')
},
{
path: 'saleOut',
name: 'saleOut',

View File

@@ -218,4 +218,171 @@ export function transformAliExpress(content) {
}
return template
}
export function transformShein(leftData) {
let rightData = {};
// 普通属性
rightData.back_size_attribute_list = []
rightData.brand_code = ''
rightData.category_id = leftData.category_id
rightData.category_id_list = []
if (leftData.category_info.level_one_category_id) {
rightData.category_id_list.push(leftData.category_info.level_one_category_id)
}
if (leftData.category_info.level_two_category_id) {
rightData.category_id_list.push(leftData.category_info.level_two_category_id)
}
if (leftData.category_info.level_three_category_id) {
rightData.category_id_list.push(leftData.category_info.level_three_category_id)
}
if (leftData.category_info.level_four_category_id) {
rightData.category_id_list.push(leftData.category_info.level_four_category_id)
}
rightData.certificate_list = []
rightData.confirm_size_img = false
rightData.extra = {
"switch_to_spu_pic": false,
"from_page_id": null,
"spu_tag": [],
"transformCvSizeImage": false,
"useCvTransformImage": false,
"confirm_volume_sku": [],
"confirm_weight_sku": []
}
rightData.image_info = {}
rightData.multi_language_desc_list = [
{
"language": "en",
"name": ""
},
{
"language": "fr",
"name": ""
},
{
"language": "es",
"name": ""
},
{
"language": "de",
"name": ""
},
{
"language": "it",
"name": ""
},
{
"language": "ru",
"name": ""
},
{
"language": "ar",
"name": ""
},
{
"language": "zh-tw",
"name": ""
},
{
"language": "zh-cn",
"name": ""
},
{
"language": "th",
"name": ""
},
{
"language": "id",
"name": ""
},
{
"language": "nl",
"name": ""
},
{
"language": "tr",
"name": ""
},
{
"language": "vi",
"name": ""
},
{
"language": "pt-br",
"name": ""
},
{
"language": "he",
"name": ""
},
{
"language": "sv",
"name": ""
},
{
"language": "pl",
"name": ""
},
{
"language": "pt-pt",
"name": ""
},
{
"language": "ko",
"name": ""
},
{
"language": "ja",
"name": ""
},
{
"language": "el-gr",
"name": ""
},
{
"language": "cs-cz",
"name": ""
},
{
"language": "ro",
"name": ""
}
]
rightData.multi_language_name_list = []
let lang = leftData.multi_language_name_list.filter(item => {
return item.language == 'zh-cn'
})
rightData.multi_language_name_list.push({
language: 'zh-cn',
name: lang[0].name
})
rightData.part_info_list = []
rightData.plm_pattern_id_list = []
rightData.product_attribute_list = leftData.product_attribute_list
rightData.product_type_id = leftData.product_type_id
rightData.product_video_list = leftData.product_video_list
rightData.sample_sku_back_size = leftData.sample_sku_back_size
rightData.site_list = leftData.site_list
rightData.size_attribute_list = leftData.size_attribute_list
rightData.skc_list = leftData.skc_list
rightData.skc_list.map(item => {
item.image_info.image_group_code = null
item.image_info.image_info_list.map(item1 => {
item1.image_item_id = null
})
})
rightData.skc_list.map(item => {
delete item.skc_name
item.sku_list.map(item1 => {
delete item1.sku_code
})
})
rightData.spp_relate_spu_name = ""
rightData.spu_name = ""
rightData.suit_flag = 0
rightData.supplier_code = null
rightData.top_category_id = leftData.category_info.level_one_category_id
return JSON.stringify(rightData);
}

View File

@@ -67,7 +67,10 @@
<i class="el-icon-goods"></i>
<span slot="title">商品管理</span>
</template>
<el-menu-item index="/productList">商品列表</el-menu-item>
<el-menu-item index="/copyProduct">商品复制</el-menu-item>
<el-menu-item index="/copyProductShein">商品复制(希音)</el-menu-item>
<!--<el-menu-item index="/copyProductAliExpress">商品复制(速卖通)</el-menu-item>-->
</el-submenu>
<el-submenu index="/stock">
<template slot="title">
@@ -121,7 +124,8 @@
<i class="el-icon-s-data"></i>
<span slot="title">销售管理</span>
</template>
<el-menu-item index="/saleData">销售管理</el-menu-item>
<el-menu-item index="/saleData">销售管理(TEMU)</el-menu-item>
<el-menu-item index="/saleDataShein">销售数据(SHEIN)</el-menu-item>
<el-menu-item index="/saleOut">售罄看板</el-menu-item>
</el-submenu>
<el-menu-item index="/info">
@@ -284,11 +288,33 @@ export default {
window.open('https://work.weixin.qq.com/kfid/kfcaa4208f661131eba', '_blank')
},
getAliexpressGoodsList() {
let url = "https://seller-acs.aliexpress.com/h5/mtop.global.merchant.self.product.manager.render.list/1.0/?jsv=2.7.2&appKey=30267743&t=1713978403051&sign=ba2bda69b4a2695c7279d4bc05f51741&v=1.0&timeout=15000&H5Request=true&url=mtop.global.merchant.self.product.manager.render.list&__channel-id__=701301&api=mtop.global.merchant.self.product.manager.render.list&type=originaljson&dataType=json&valueType=original&x-i18n-regionID=AE"
url = url + "&data=" + encodeURIComponent(
JSON.stringify({
"channelId": "701301",
"jsonBody": JSON.stringify({
"tab": "online_product",
"sort": {},
"filter": {
"queryCategory": null,
"lowerPrice": null,
"upperPrice": null,
"status": "0",
"productId": null,
"pagination": {
"pageSize": 10,
"current": 3
}
}
}),
"from":"SELF",
"bizParam":"{\"version\":\"simple\"}"
})
)
sendAliexpressAPIMessage({
type: "aliexpress",
url: "https://seller-acs.aliexpress.com/h5/mtop.global.merchant.self.product.manager.render.list/1.0/?jsv=2.7.2&appKey=30267743&t=1713978403051&sign=ba2bda69b4a2695c7279d4bc05f51741&v=1.0&timeout=15000&H5Request=true&url=mtop.global.merchant.self.product.manager.render.list&__channel-id__=701301&api=mtop.global.merchant.self.product.manager.render.list&type=originaljson&dataType=json&valueType=original&x-i18n-regionID=AE&data=%7B%22channelId%22%3A%22701301%22%2C%22jsonBody%22%3A%22%7B%5C%22tab%5C%22%3A%5C%22online_product%5C%22%2C%5C%22sort%5C%22%3A%7B%7D%2C%5C%22filter%5C%22%3A%7B%5C%22queryCategory%5C%22%3Anull%2C%5C%22lowerPrice%5C%22%3Anull%2C%5C%22upperPrice%5C%22%3Anull%2C%5C%22status%5C%22%3A%5C%220%5C%22%2C%5C%22productId%5C%22%3Anull%7D%2C%5C%22pagination%5C%22%3A%7B%5C%22pageSize%5C%22%3A10%2C%5C%22current%5C%22%3A3%7D%7D%22%2C%22from%22%3A%22SELF%22%2C%22bizParam%22%3A%22%7B%5C%22version%5C%22%3A%5C%22simple%5C%22%7D%22%7D",
url: url
}).then(res => {
console.log(res)
//console.log(res)
})
},
},

View File

@@ -274,7 +274,7 @@ import AiLazyCascader from "@/components/AiLazyCascader.vue"
methods: {
getList () {
this.$http.post('/api/product/myPage',null,{
this.$http.post('/api/product/myPage?type=0',null,{
params: {
...this.search
}
@@ -463,6 +463,7 @@ import AiLazyCascader from "@/components/AiLazyCascader.vue"
mallName: mallInfo[0].mallName,
productSpu: res.result.productId,
productName: res.result.productName,
type: 0,
content: content
}).then(res1 => {
if (res1.code == 0) {
@@ -495,6 +496,7 @@ import AiLazyCascader from "@/components/AiLazyCascader.vue"
mallName: mallInfo[0].mallName,
productSpu: spu,
productName: res.result.productName,
type: 0,
content: content
}).then(res1 => {
if (res1.code == 0) {

View File

@@ -0,0 +1,402 @@
<template>
<div>
<ai-list class="list" v-loading="isLoading" :element-loading-text="'数据正在加载中……'">
<ai-title
slot="title"
title="商品模板"
tips="请先在当前浏览器登录“速卖通跨境卖家中心”,期间保持登录状态"
isShowBottomBorder>
</ai-title>
<template slot="content">
<div class="content">
<ai-search-bar>
<template #left>
<el-button type="button" :icon="'el-icon-delete'" :class="'el-button el-button--primary'" @click="remove()">删除</el-button>
<el-button type="button" :class="'el-button el-button--primary'" @click="toAddTemplate()">添加商品模板</el-button>
<el-button type="button" :class="'el-button el-button--primary'" @click="beforeAddToDraft">添加到草稿箱</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"
@selection-change="handleSelectionChange"
@getList="getList">
</ai-table>
</div>
</template>
</ai-list>
<el-dialog
title="商品列表"
:visible.sync="dlgShow"
:close-on-click-modal="false"
width="80%"
:before-close="handleClose">
<ai-list class="list">
<template slot="content">
<div class="content">
<ai-search-bar>
<template #left>
<div class="search-item">
<label style="width:90px">模板来源</label>
<el-select v-model="productPage.from" @change="productTableData = [], productPage.total = 0, productPage.page =1, getProductOrDraftList()" placeholder="请选择">
<el-option
key="0"
label="商品列表"
value="0">
</el-option>
<el-option
key="1"
label="草稿箱列表"
value="1">
</el-option>
</el-select>
</div>
<div class="search-item">
<label style="width:90px">商品名称</label>
<el-input size="small" placeholder="请输入商品名称" v-model="productPage.productName" @keyup.enter.native="productPage.page =1, getProductList()"></el-input>
</div>
</template>
<template #right>
<el-button @click="productPage= {
page: 1,
pageSize: 10,
from: '0',
productName: '',
productSkcIds: ''
}, getProductOrDraftList()">重置</el-button>
<el-button type="primary" @click="productPage.page =1, getProductOrDraftList()">查询</el-button>
</template>
</ai-search-bar>
<ai-table
:tableData="productTableData"
:col-configs="productColConfigs"
:total="productPage.total"
:current.sync="productPage.page" :size.sync="productPage.pageSize"
style="margin-top: 8px;"
@selection-change="productHandleSelectionChange"
@getList="getProductOrDraftList">
<el-table-column slot="imageUrl" width="120px" label="图片" align="center">
<template slot-scope="scope">
<div>
<el-image :src="scope.row.imageUrl" class="image" :preview-src-list="[scope.row.imageUrl]" />
</div>
</template>
</el-table-column>
</ai-table>
</div>
</template>
</ai-list>
<span slot="footer" class="dialog-footer">
<el-button @click="dlgShow = false"> </el-button>
<el-button type="primary" @click="saveProduct">添加到模板</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {sendChromeAPIMessage, sendAliexpressAPIMessage} from '@/api/chromeApi'
import {timestampToTime} from '@/utils/date'
import {transformShein} from '@/utils/product'
import { Message } from 'element-ui'
import AiLazyCascader from "@/components/AiLazyCascader.vue"
export default {
name: 'CopyProduct',
components: {AiLazyCascader},
data () {
return {
search: {
current: 1,
size: 10,
productName: '',
mallName: '',
startDate: '',
endDate: ''
},
colConfigs: [
{ type: "selection", width: '70px', align: 'left', fixed: 'left'},
{ prop: 'productSpu', label: 'SPU', width: 180, align: 'left' },
{ prop: 'productName', label: '商品名称', align: 'left' },
{ prop: 'createTime', label: '添加时间', width: '180px', fixed: 'right'}
],
tableData: [],
total: 0,
ids: [],
dlgShow: false,
productTableData: [],
productPage: {page: 1, pageSize: 10, mallId: '', from: '0', productName: '', productSkcIds: '', total: 0},
productColConfigs: [
{ type: "selection", width: '70px', align: 'left', fixed: 'left'},
{ prop: 'productSpu', label: 'SPU ID', width: 180, align: 'left' },
{ slot: 'imageUrl', label: '图片', align: 'left' },
{ prop: 'productName', label: '商品名称', align: 'left' },
{ prop: 'createTime', label: '创建时间', width: 180, align: 'left' }
],
productIds: [],
siteList: [],
isLoading: false
}
},
created () {
this.getList()
},
methods: {
getList () {
this.$http.post('/api/product/myPage?type=1',null,{
params: {
...this.search
}
}).then(res => {
this.tableData = res.data.records
this.total = res.data.total
})
},
remove () {
if (this.ids.length <= 0) {
alert('请选择要删除的商品');
return;
}
this.$confirm('确定要删除?', '温馨提示', {
type: 'warning'
}).then(() => {
this.$http.post('/api/product/delByIds',this.ids
).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
handleSelectionChange(val) {
this.ids = [];
val.forEach(e => {
this.ids.push(e.id);
});
},
// 添加模板
handleClose() {
this.productTableData = []
this.productPage = {page: 1, pageSize: 10, from: '0', total: 0}
this.dlgShow = false
},
toAddTemplate() {
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;
}
this.dlgShow = true
this.getProductOrDraftList()
}
})
},
getProductOrDraftList() {
if (this.productPage.from == '0') {
this.getProductList()
} else {
this.getDraftList()
}
},
getDraftList() {
let params = {};
params.page = this.productPage.page;
params.pageSize = this.productPage.pageSize;
if (this.productPage.productName) {
params.productName = this.productPage.productName
}
sendChromeAPIMessage({
url: 'bg-visage-mms/product/draft/pageQuery',
needMallId: true,
mallId: this.productPage.mallId,
data: {
...params
}}).then((res) => {
if (res.errorCode == 1000000) {
this.productPage.total = res.result.total
this.productTableData = res.result.pageItems.map((item) => {
return {
productSpu: item.productDraftId,
productSkc: '',
productName: item.productName,
createTime: timestampToTime(item.updatedAt)
};
})
} else {
this.getDraftList()
}
});
},
async getProductList() {
this.isLoading = true
let url = "https://seller-acs.aliexpress.com/h5/mtop.global.merchant.self.product.manager.render.list/1.0/?jsv=2.7.2&appKey=30267743&t=1713978403051&sign=ba2bda69b4a2695c7279d4bc05f51741&v=1.0&timeout=15000&H5Request=true&url=mtop.global.merchant.self.product.manager.render.list&__channel-id__=701301&api=mtop.global.merchant.self.product.manager.render.list&type=originaljson&dataType=json&valueType=original&x-i18n-regionID=AE"
url = url + "&data=" + encodeURIComponent(
JSON.stringify({
"channelId": "701301",
"jsonBody": JSON.stringify({
"tab": "online_product",
"sort": {},
"filter": {
"queryCategory": null,
"lowerPrice": null,
"upperPrice": null,
"status": "0",
"productId": null,
"pagination": {
"pageSize": this.productPage.page,
"current": this.productPage.pageSize
}
}
}),
"from":"SELF",
"bizParam":"{\"version\":\"simple\"}"
})
)
let res = await sendAliexpressAPIMessage({
url: url
})
res = JSON.parse(res)
this.isLoading = false
if (res.ret.indexOf('SUCCESS::调用成功') >= 0) {
this.productPage.total = res.data.data.pagination.total
this.productTableData = res.data.data.table.dataSource.map((item) => {
return {
productSpu: item.productId,
productName: item.itemDesc.title,
imageUrl: item.itemDesc.imageUrl,
createTime: timestampToTime(item.selfCreateDesc)
};
})
}
},
productHandleSelectionChange(val) {
this.productIds = [];
val.forEach(e => {
this.productIds.push(e.productSpu);
});
},
saveProduct() {
if (this.productIds.length <= 0) {
Message.error('请选择商品');
return;
}
this.productIds.map((productSpu, index) => {
setTimeout(() => {
if (this.productPage.from == '0') {
this.saveProductTemplate(productSpu, index)
} else {
this.saveDraftTemplate(productSpu, index)
}
}, 200 * index)
})
},
saveProductTemplate(spu, index) {
sendGeiwohuoAPIMessage({
url: 'spmp-api-prefix/spmp/product/get_product_detail',
data: {
spu_name: spu
}}).then((res) => {
if (res.code == 0) {
let content = transformShein(res.info)
let productName = res.info.multi_language_name_list.filter(item => {
return item.language == 'zh-cn'
})
console.log(productName)
this.$http.post('/api/product/add', {
productSpu: res.info.spu_name,
productName: productName[0].name,
type: 2,
content: content
}).then(res1 => {
if (res1.code == 0) {
Message.success("商品【" + productName[0].name + "】成功添加为商品模板")
if (index == this.productIds.length - 1) {
this.getList()
}
}
})
} else {
this.saveProductTemplate(spu, index)
}
})
},
saveDraftTemplate(spu, index) {
sendChromeAPIMessage({
url: 'bg-visage-mms/product/draft/query',
needMallId: true,
mallId: this.productPage.mallId,
data: {
productDraftId: spu
}}).then((res) => {
if (res.errorCode == 1000000) {
let content = transformShein(res.info)
let productName = res.info.multi_language_name_list.filter(item => {
return item.language == 'zh-cn'
})
this.$http.post('/api/product/add', {
productSpu: spu,
productName: productName[0].name,
content: content,
type: 2
}).then(res1 => {
if (res1.code == 0) {
Message.success("商品【" + productName[0].name + "】成功添加为商品模板")
if (index == this.productIds.length - 1) {
this.getList()
}
}
})
} else {
this.saveDraftTemplate(spu, index)
}
})
},
beforeAddToDraft() {
if (this.ids.length <= 0) {
Message.error('请选择商品模板');
return;
}
this.addToDraft()
},
addToDraft() {
this.ids.map((id, index) => {
let product = this.tableData.filter((item) => {
return item.id == id
})
let content = JSON.parse(product[0].content)
setTimeout(() => {
sendGeiwohuoAPIMessage({
url: 'spmp-api-prefix/spmp/product/save_draft',
data: content
}).then((res) => {
if (res.code == 0) {
Message.success("商品【" + product[0].productName + "】成功添加到草稿箱")
} else {
Message.error(res.errorMsg)
}
})
}, 1000*index)
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,377 @@
<template>
<div>
<ai-list class="list" v-loading="isLoading" :element-loading-text="'数据正在加载中……'">
<ai-title
slot="title"
title="商品模板"
tips="请先在当前浏览器登录“希音商家后台”,期间保持登录状态"
isShowBottomBorder>
</ai-title>
<template slot="content">
<div class="content">
<ai-search-bar>
<template #left>
<el-button type="button" :icon="'el-icon-delete'" :class="'el-button el-button--primary'" @click="remove()">删除</el-button>
<el-button type="button" :class="'el-button el-button--primary'" @click="toAddTemplate()">添加商品模板</el-button>
<el-button type="button" :class="'el-button el-button--primary'" @click="beforeAddToDraft">添加到草稿箱</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"
@selection-change="handleSelectionChange"
@getList="getList">
</ai-table>
</div>
</template>
</ai-list>
<el-dialog
title="商品列表"
:visible.sync="dlgShow"
:close-on-click-modal="false"
width="80%"
:before-close="handleClose">
<ai-list class="list">
<template slot="content">
<div class="content">
<ai-search-bar>
<template #left>
<div class="search-item">
<label style="width:90px">模板来源</label>
<el-select v-model="productPage.from" @change="productTableData = [], productPage.total = 0, productPage.page =1, getProductOrDraftList()" placeholder="请选择">
<el-option
key="0"
label="商品列表"
value="0">
</el-option>
<el-option
key="1"
label="草稿箱列表"
value="1">
</el-option>
</el-select>
</div>
<div class="search-item">
<label style="width:90px">商品名称</label>
<el-input size="small" placeholder="请输入商品名称" v-model="productPage.productName" @keyup.enter.native="productPage.page =1, getProductList()"></el-input>
</div>
</template>
<template #right>
<el-button @click="productPage= {
page: 1,
pageSize: 10,
from: '0',
productName: '',
productSkcIds: ''
}, getProductOrDraftList()">重置</el-button>
<el-button type="primary" @click="productPage.page =1, getProductOrDraftList()">查询</el-button>
</template>
</ai-search-bar>
<ai-table
:tableData="productTableData"
:col-configs="productColConfigs"
:total="productPage.total"
:current.sync="productPage.page" :size.sync="productPage.pageSize"
style="margin-top: 8px;"
@selection-change="productHandleSelectionChange"
@getList="getProductOrDraftList">
</ai-table>
</div>
</template>
</ai-list>
<span slot="footer" class="dialog-footer">
<el-button @click="dlgShow = false"> </el-button>
<el-button type="primary" @click="saveProduct">添加到模板</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {sendChromeAPIMessage, sendGeiwohuoAPIMessage} from '@/api/chromeApi'
import {timestampToTime} from '@/utils/date'
import {transformShein} from '@/utils/product'
import { Message } from 'element-ui'
export default {
name: 'CopyProductShein',
data () {
return {
search: {
current: 1,
size: 10,
productName: '',
mallName: '',
startDate: '',
endDate: ''
},
colConfigs: [
{ type: "selection", width: '70px', align: 'left', fixed: 'left'},
{ prop: 'productSpu', label: 'SPU', width: 180, align: 'left' },
{ prop: 'productName', label: '商品名称', align: 'left' },
{ prop: 'createTime', label: '添加时间', width: '180px', fixed: 'right'}
],
tableData: [],
total: 0,
ids: [],
dlgShow: false,
productTableData: [],
productPage: {page: 1, pageSize: 10, mallId: '', from: '0', productName: '', productSkcIds: '', total: 0},
productColConfigs: [
{ type: "selection", width: '70px', align: 'left', fixed: 'left'},
{ prop: 'productSpu', label: 'SPU ID', align: 'left' },
{ prop: 'costRange', label: '价格区间', align: 'left' },
{ prop: 'productName', label: '商品名称', align: 'left' },
{ prop: 'createTime', label: '创建时间', align: 'left' }
],
productIds: [],
siteList: [],
isLoading: false
}
},
created () {
this.getList()
},
methods: {
getList () {
this.$http.post('/api/product/myPage?type=2',null,{
params: {
...this.search
}
}).then(res => {
this.tableData = res.data.records
this.total = res.data.total
})
},
remove () {
if (this.ids.length <= 0) {
alert('请选择要删除的商品');
return;
}
this.$confirm('确定要删除?', '温馨提示', {
type: 'warning'
}).then(() => {
this.$http.post('/api/product/delByIds',this.ids
).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
handleSelectionChange(val) {
this.ids = [];
val.forEach(e => {
this.ids.push(e.id);
});
},
// 添加模板
handleClose() {
this.productTableData = []
this.productPage = {page: 1, pageSize: 10, from: '0', total: 0}
this.dlgShow = false
},
toAddTemplate() {
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;
}
this.dlgShow = true
this.getProductOrDraftList()
}
})
},
getProductOrDraftList() {
if (this.productPage.from == '0') {
this.getProductList()
} else {
this.getDraftList()
}
},
getDraftList() {
let params = {};
params.page = this.productPage.page;
params.pageSize = this.productPage.pageSize;
if (this.productPage.productName) {
params.productName = this.productPage.productName
}
sendChromeAPIMessage({
url: 'bg-visage-mms/product/draft/pageQuery',
needMallId: true,
mallId: this.productPage.mallId,
data: {
...params
}}).then((res) => {
if (res.errorCode == 1000000) {
this.productPage.total = res.result.total
this.productTableData = res.result.pageItems.map((item) => {
return {
productSpu: item.productDraftId,
productSkc: '',
productName: item.productName,
createTime: timestampToTime(item.updatedAt)
};
})
} else {
this.getDraftList()
}
});
},
async getProductList() {
this.isLoading = true
let res = await sendGeiwohuoAPIMessage({
url: "spmp-api-prefix/spmp/product/list?page_num=" + this.productPage.page + "&page_size=" + this.productPage.pageSize,
method: 'POST',
data: {
"language": "zh-cn",
"product_name": this.productPage.productName,
"sort_type": 1
}
})
this.isLoading = false
if (res.code == 0) {
this.productPage.total = res.info.meta.count
this.productTableData = res.info.data.map((item) => {
return {
productSpu: item.spu_name,
costRange: item.cost_range,
productName: item.product_name_multi,
createTime: item.create_time
};
})
}
},
productHandleSelectionChange(val) {
this.productIds = [];
val.forEach(e => {
this.productIds.push(e.productSpu);
});
},
saveProduct() {
if (this.productIds.length <= 0) {
Message.error('请选择商品');
return;
}
this.productIds.map((productSpu, index) => {
setTimeout(() => {
if (this.productPage.from == '0') {
this.saveProductTemplate(productSpu, index)
} else {
this.saveDraftTemplate(productSpu, index)
}
}, 200 * index)
})
},
saveProductTemplate(spu, index) {
sendGeiwohuoAPIMessage({
url: 'spmp-api-prefix/spmp/product/get_product_detail',
method: 'POST',
data: {
spu_name: spu
}}).then((res) => {
if (res.code == 0) {
let content = transformShein(res.info)
let productName = res.info.multi_language_name_list.filter(item => {
return item.language == 'zh-cn'
})
console.log(productName)
this.$http.post('/api/product/add', {
productSpu: res.info.spu_name,
productName: productName[0].name,
type: 2,
content: content
}).then(res1 => {
if (res1.code == 0) {
Message.success("商品【" + productName[0].name + "】成功添加为商品模板")
if (index == this.productIds.length - 1) {
this.getList()
}
}
})
} else {
this.saveProductTemplate(spu, index)
}
})
},
saveDraftTemplate(spu, index) {
sendChromeAPIMessage({
url: 'bg-visage-mms/product/draft/query',
needMallId: true,
mallId: this.productPage.mallId,
data: {
productDraftId: spu
}}).then((res) => {
if (res.errorCode == 1000000) {
let content = transformShein(res.info)
let productName = res.info.multi_language_name_list.filter(item => {
return item.language == 'zh-cn'
})
this.$http.post('/api/product/add', {
productSpu: spu,
productName: productName[0].name,
content: content,
type: 2
}).then(res1 => {
if (res1.code == 0) {
Message.success("商品【" + productName[0].name + "】成功添加为商品模板")
if (index == this.productIds.length - 1) {
this.getList()
}
}
})
} else {
this.saveDraftTemplate(spu, index)
}
})
},
beforeAddToDraft() {
if (this.ids.length <= 0) {
Message.error('请选择商品模板');
return;
}
this.addToDraft()
},
addToDraft() {
this.ids.map((id, index) => {
let product = this.tableData.filter((item) => {
return item.id == id
})
let content = JSON.parse(product[0].content)
setTimeout(() => {
sendGeiwohuoAPIMessage({
url: 'spmp-api-prefix/spmp/product/save_draft',
method: 'POST',
data: content
}).then((res) => {
if (res.code == 0) {
Message.success("商品【" + product[0].productName + "】成功添加到草稿箱")
} else {
Message.error(res.errorMsg)
}
})
}, 1000*index)
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,227 @@
<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="form.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>
<label style="width:140px">是否在售</label>
<el-select clearable v-model="reqData.skcSiteStatus" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<label style="width:140px">商品名称</label>
<el-input clearable size="small" style="display: inline" placeholder="请输入商品名称" v-model="reqData.productName"></el-input>
<el-button type="primary" @click="toLoad">加载</el-button>&nbsp;
<json-excel
:data="tableData"
:fields="jsonFields"
name="商品列表.xls"
worksheet="商品列表">
<el-button type="primary" :disabled="tableData.length == 0">下载数据</el-button>
</json-excel>
</template>
<ai-table
:isShowPagination="false"
:tableData="tableData"
:col-configs="colConfigs"
:total="tableData.length"
height="500"
style="margin-top: 8px;"
@getList="() => {}">
<el-table-column slot="productName" width="200px" :show-overflow-tooltip='true' label="商品名称" fixed="left">
<template slot-scope="scope">
<div>
<el-image :src="scope.row.mainImageUrl" style="width: 40px; height: 40px" class="image" :preview-src-list="[scope.row.mainImageUrl]" />
{{ scope.row.productName }}
</div>
</template>
</el-table-column>
</ai-table>
</ai-card>
</template>
</ai-list>
</template>
<script>
import { Message } from 'element-ui'
import {sendChromeAPIMessage} from '@/api/chromeApi'
import {timestampToTime} from '@/utils/date'
import JsonExcel from 'vue-json-excel'
export default {
name: 'MyNormalOrder',
data () {
return {
form: {
mallId: ''
},
reqData: {
productName: '',
page: 1,
pageSize: 100,
skcSiteStatus: ''
},
options: [
{label: '是', value: 1},
{label: '否', value: 0}
],
colConfigs: [
{ slot: 'productName', label: '商品名称', width: '180px', align: 'left', fixed: 'left' },
{ prop: 'category', label: '分类', width: '140px', align: 'left', fixed: 'left' },
{ prop: 'productId', label: 'SPU ID', width: '120px', align: 'left' },
{ prop: 'productSkcId', label: 'SKC ID', width: '120px', align: 'left' },
{ prop: 'productSkuId', label: 'SKU ID', width: '120px', align: 'left' },
{ prop: 'skcSiteStatus', label: '是否在售', width: '120px', align: 'left' },
{ prop: 'extCode', label: 'SKC货号', width: '100px', align: 'left' },
{ prop: 'skuExtCode', label: 'SKU货号', width: '160px', align: 'left' },
{ prop: 'specName', label: 'SKU属性', width: '100px', align: 'left' },
{ prop: 'supplierPrice', label: '申报价格(CNY)', width: '180px', align: 'left' },
{ prop: 'todaySalesVolume', label: '今日销量', width: '100px', align: 'left' },
{ prop: 'createdAt', label: '上架时间', width: '160px', align: 'left' }
],
isLoading: false,
tableData: [],
jsonFields: {
"商品名称": "productName",
"图片": "mainImageUrl",
"分类": "category",
"SPU ID": "productId",
"SKC ID": "productSkcId",
"SKU ID": "productSkuId",
"是否在售": "skcSiteStatus",
"SKC货号": "extCode",
"SKU货号": "skuExtCode",
"SKU属性": "specName",
"申报价格(CNY)": "supplierPrice",
"今日销量": "todaySalesVolume",
"上架时间": "createdAt"
},
currentIndex: 0
}
},
components: {
JsonExcel
},
methods: {
beforeGetList() {
this.$userCheck(this.form.mallId).then(() => {
this.toLoad()
}).catch((err) => {
this.form.mallId = ''
})
},
toLoad() {
if (!this.form.mallId) {
Message.error("请选择店铺")
return
}
this.reqData.page = 1
this.tableData = []
this.currentIndex = 0
this.isLoading = true
this.load()
},
load() {
sendChromeAPIMessage({
url: 'bg-visage-mms/product/skc/pageQuery',
needMallId: true,
mallId: this.form.mallId,
anti: true,
data: this.reqData}).then((res) => {
if (res.errorCode == 1000000) {
for(let i = 0;i < res.result.pageItems.length; i++) {
let item = res.result.pageItems[i];
let data = {};
data.productName = item.productName
data.mainImageUrl = item.mainImageUrl
data.productId = item.productId
data.productSkcId = item.productSkcId
data.skcSiteStatus = item.skcSiteStatus == '1'? '在售': ''
data.createdAt = timestampToTime(item.createdAt)
data.extCode = item.extCode
data.category = ''
for (let i = 1; i < 11; i++) {
if (item.categories['cat'+i].catName) {
data.category += '->' + item.categories['cat'+i].catName
} else {
break
}
}
data.category = data.category.substring(2)
for(let k = 0; k < item.productSkuSummaries.length; k++) {
let temp = item.productSkuSummaries[k].productSkuSpecList.map(item2 => {
return item2.parentSpecName + "" + item2.specName
})
data = {...data,
productSkuId: item.productSkuSummaries[k].productSkuId,
skuExtCode: item.productSkuSummaries[k].extCode,
supplierPrice: item.productSkuSummaries[k].supplierPrice / 100,
specName: temp.join(""),
todaySalesVolume: item.productSkuSummaries[k].todaySalesVolume}
this.tableData.push(data)
}
}
if (this.reqData.page == 1 && res.result.pageItems.length == 0) {
this.isLoading = false
}
else if (res.result.pageItems.length == 100) {
this.reqData.page ++
this.load()
} else {
this.isLoading = false
}
}
})
}
}
}
</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

@@ -0,0 +1,491 @@
<template>
<ai-list class="list" v-loading="isLoading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
<ai-title
slot="title"
title="销售数据(希音)"
isShowBottomBorder>
</ai-title>
<template slot="content">
<div class="top">
<div class="item">
<h2>今日销量</h2>
<p>{{ todayTotal }}</p>
</div>
<div class="item">
<h2>今日销售额</h2>
<p>{{ todayMoney }}</p>
</div>
<div class="item">
<h2>可用库存总量()</h2>
<p>{{ inventoryTotal }}</p>
</div>
<div class="item">
<h2>可用库存总额</h2>
<p>{{ inventoryMoney }}</p>
</div>
<div class="item">
<h2><span>在途库存总量()<el-tooltip
effect="dark"
content="在途数量的总和"
placement="right">
<i class="el-icon-question"
style="font-size: 16px; vertical-align: middle;"></i>
</el-tooltip></span></h2>
<p>{{ inroadTotal }}</p>
</div>
<div class="item">
<h2><span>在途库存总额<el-tooltip
effect="dark"
content="在途数量*价格"
placement="right">
<i class="el-icon-question"
style="font-size: 16px; vertical-align: middle;"></i>
</el-tooltip></span></h2>
<p>{{ inroadTotalMoney }}</p>
</div>
</div>
<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
ref="table0"
:isShowPagination="false"
:tableData="list"
height="500"
:col-configs="colConfigs"
:total="list.length"
style="margin-top: 8px;"
@getList="() => {}">
<el-table-column slot="goodsThumb" width="120px" label="商品图片" fixed="left">
<template slot-scope="scope">
<div>
<el-image :src="scope.row.goodsThumb" style="width: 40px; height: 40px" class="image" :preview-src-list="[scope.row.goodsThumb]" />
</div>
</template>
</el-table-column>
</ai-table>
</ai-card>
</template>
</ai-list>
</template>
<script>
import {sendGeiwohuoAPIMessage} from '@/api/chromeApi'
import JsonExcel from 'vue-json-excel'
import { Message } from 'element-ui'
export default {
name: 'ExportSaleData',
data () {
return {
list: [],
isLoading: false,
pageSize: 100,
currentPage: 1,
todayTotal: 0,
todayMoney: 0.0,
inventoryTotal: 0,
inventoryMoney: 0.0,
inroadTotal: 0,
inroadTotalMoney: 0.0,
deliveryTotal: 0,
deliveryMoney: 0.0,
startDate: '',
endDate: '',
skuIds: [],
jsonFields: {
"商品名称": "productName",
"SPU": "productId",
"SKC": "productSkcId",
"SKU ID": "productSkuId",
"SKU属性": "className",
"SKU货号": "skuExtCode",
"加入站点时长": "onSalesDurationOffline",
"图片链接": "productSkcPicture",
"申报价格(CNY)": {
"field": "supplierPrice",
callback: (value) => {
return value /100;
}
},
"开款核价状态": {
"field": "isVerifyPrice",
callback: (value) => {
return value ? '核价通过': '核价未通过 / 无法备货';
}
},
"缺货数量": "lackQuantity",
"建议备货量": "adviceQuantity",
"可售天数": "availableSaleDays",
"库存可售天数": "availableSaleDaysFromInventory",
"仓内库存可售天数": "warehouseAvailableSaleDays",
"近7日用户加购数量": "inCartNumber7d",
"用户累计加购数量": "inCardNumber",
"已订阅待提醒到货": "nomsgSubsCntCntSth",
"销售数据 - 今日": "todaySaleVolume",
"销售数据 - 近7日": "lastSevenDaysSaleVolume",
"销售数据 - 近30天": "lastThirtyDaysSaleVolume",
"库存数据 - 仓内可用库存": "inventoryNumInfo.warehouseInventoryNum",
"库存数据 - 仓内暂不可用库存": "inventoryNumInfo.waitOnShelfNum",
"库存数据 - 已发货库存": "inventoryNumInfo.waitReceiveNum",
"库存数据 - 已下单待发货库存": "inventoryNumInfo.waitDeliveryInventoryNum",
"库存数据 - 待审核备货库存": "inventoryNumInfo.waitApproveInventoryNum",
"VMI备货单数 - 待发货": "vmiOrderInfo.waitDeliveryNum",
"VMI备货单数 - 在途单数": "vmiOrderInfo.transportationNum",
"VMI备货单数 - 发货延迟": "vmiOrderInfo.deliveryDelayNum",
"VMI备货单数 - 到货延迟": "vmiOrderInfo.arrivalDelayNum",
"非VMI备货单数 - 待发货": "notVmiOrderInfo.waitDeliveryNum",
"非VMI备货单数 - 在途单数": "notVmiOrderInfo.transportationNum",
"非VMI备货单数 - 发货延迟": "notVmiOrderInfo.deliveryDelayNum",
"非VMI备货单数 - 到货延迟": "notVmiOrderInfo.arrivalDelayNum",
"备货逻辑": "purchaseConfig",
"可用库存货值(CNY)": "productTotalPrice",
"在途库存货值(CNY)": "inroadTotalPrice",
"店铺名称": "mallName",
"评分": "mark",
"是否热销": 'hotTag',
"生产建议信息 - 建议生产数": 'adviceProduceNum',
"生产建议信息 - 剩余件数": 'availableProduceNum',
"类目": 'category'
},
skuSaleNumberFields: {},
skuSaleNumberList: [],
downloadSkuSaleNumberDlg: false,
skuDownloadForm: {
date: ''
},
}
},
computed: {
colConfigs () {
return [
{
slot: 'goodsThumb',
label: '图片'
},
{
prop: 'supplierCode',
label: '货号',
width: '120px',
align: 'center',
fixed: 'left'
},
{
prop: 'suffixZh',
label: '规格',
width: '160px',
align: 'center',
fixed: 'left'
},
{
prop: 'categoryName',
label: '分类',
"show-overflow-tooltip": true,
width: '100px'
},
{
prop: 'mallStatusName',
label: '状态',
width: '120px',
align: 'center'
},
{
prop: 'skc',
label: 'SKC',
width: '160px',
align: 'center'
},
{
prop: 'ableSaleDays',
label: '可售天数',
align: 'center'
},
{
prop: 'cost',
label: '价格',
width: '120px',
align: 'center'
},
{
prop: 'todaySale',
label: '今日销量',
width: '120px',
align: 'center'
},
{
prop: 'saleInfoWeek',
label: '近7天销量',
width: '120px',
align: 'center'
},
{
prop: 'saleInfoMonth',
label: '本月销量',
width: '120px',
align: 'center'
},
{
prop: 'saleInfoPreMonth',
label: '上月销量',
width: '120px',
align: 'center'
},
{
prop: 'purchaseConfig',
label: '备货逻辑',
width: '160px',
align: 'center'
},
{
prop: 'onWayNum',
label: '在途数量',
width: '160px',
align: 'center'
},
{
prop: 'ivtNum',
label: '库存数量',
width: '160px',
align: 'center'
},
{
prop: 'productTotalPrice',
label: '库存货值(CNY)',
width: '180px',
align: 'center',
fixed: "right",
sortable: true,
'sort-method': (a, b) => {
return a.productTotalPrice - b.productTotalPrice
}
},
{
prop: 'inroadTotalPrice',
label: '在途货值(CNY)',
width: '180px',
align: 'center',
fixed: "right",
sortable: true,
'sort-method': (a, b) => {
return a.inroadTotalPrice - b.inroadTotalPrice
}
},
{
prop: 'purchaseConfig',
label: '备货逻辑',
align: 'center',
width: '120px',
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
}
}
}
]
}
},
components: {
JsonExcel
},
mounted () {
this.beforeGetList()
},
methods: {
beforeGetList() {
this.list = []
this.currentPage = 1
this.todayMoney = 0.0
this.todayTotal = 0
this.inventoryMoney = 0.0
this.inventoryTotal = 0
this.inroadTotalMoney = 0.0
this.inroadTotal = 0
this.isLoading = true
this.getList()
},
getList () {
sendGeiwohuoAPIMessage({
url: 'gmpj/goods/goods/list',
method: 'POST',
data: {
"mallStatusList": [
1
],
"page": this.currentPage,
"perPage": this.pageSize
}}).then((res) => {
if (res.code == '0' && res.msg == "OK") {
for(let i = 0;i < res.info.list.length; i++) {
let item = res.info.list[i];
let data = {};
data.categoryName = item.categoryName
data.goodsThumb = item.goodsThumb
data.mallStatusName = item.mallStatusName
data.supplierCode = item.supplierCode
data.skc = item.skc
for(let j = 0;j < item.sizes.length; j++) {
let sku = item.sizes[j]
data = {...data,
ableSaleDays: sku.ableSaleDays,
cost: sku.cost,
purchaseConfig: (sku.operateTime?sku.operateTime:'/') + '+' + (sku.prepareDay?sku.prepareDay:'/'),
saleInfoMonth: sku.saleInfoMonth,
saleInfoPreMonth: sku.saleInfoPreMonth,
saleInfoWeek: sku.saleInfoWeek,
suffixZh: sku.suffixZh,
todaySale: sku.todaySale,
onWayNum: sku.onWayNum,
ivtNum: sku.ivtNum,
productTotalPrice: (sku.cost * sku.ivtNum).toFixed(2),
inroadTotalPrice: (sku.cost * sku.onWayNum).toFixed(2)}
this.todayTotal += sku.todaySale
this.todayMoney += new Number((sku.cost * sku.todaySale).toFixed(2))
this.todayMoney = new Number(this.todayMoney.toFixed(2))
this.inventoryTotal += sku.ivtNum
this.inventoryMoney += new Number((sku.cost * sku.ivtNum).toFixed(2))
this.inventoryMoney = new Number(this.inventoryMoney.toFixed(2))
this.inroadTotal += sku.onWayNum
this.inroadTotalMoney += new Number((sku.cost * sku.onWayNum).toFixed(2))
this.inroadTotalMoney = new Number(this.inroadTotalMoney.toFixed(2))
this.list.push(data);
}
}
if (this.pageSize == res.info.list.length) {
this.currentPage ++
setTimeout(() => {
this.getList()
}, 1500)
} else {
this.isLoading = false
Message.success('销售数据加载完成,可进行导出')
this.$nextTick(() => { //在数据加载完,重新渲染表格
this.$refs['table0'].doLayout();
})
}
} else {
setTimeout(() => {
this.getList()
}, 1500)
}
}).catch(() => {
this.isLoading = false
})
},
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;
}
}
.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;
}
}
}
}
.like {
cursor: pointer;
font-size: 25px;
display: inline-block;
}
</style>

View File

@@ -107,7 +107,7 @@
: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-form-item label="来源:" style="width: 100%;" prop="source" :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>

View File

@@ -116,6 +116,7 @@ import JsonExcel from 'vue-json-excel'
{ prop: 'extCode', label: 'SKU货号', width: '160px', align: 'left' },
{ prop: 'specName', label: 'SKU属性', width: '100px', align: 'left' },
{ prop: 'supplierPrice', label: '申报价格(CNY)', width: '180px', align: 'left' },
{ prop: 'purchaseQuantity', label: '备货件数', width: '100px', align: 'left' },
{ prop: 'xiadan', label: '送货数量', width: '100px', align: 'left' },
{ prop: 'skuNum', label: '入库数量', width: '100px', align: 'left' },
{ prop: 'deliveryOrderSn', label: '发货单号', width: '140px', align: 'left' },
@@ -136,6 +137,7 @@ import JsonExcel from 'vue-json-excel'
"SKU货号": "extCode",
"SKU属性": "specName",
"申报价格(CNY)": "supplierPrice",
"备货件数": "purchaseQuantity",
"下单数量": "xiadan",
"实际入库数量": "skuNum",
"发货单号": "deliveryOrderSn",
@@ -205,6 +207,7 @@ import JsonExcel from 'vue-json-excel'
specName: item.skuQuantityDetailList[k].className,
extCode: item.skuQuantityDetailList[k].extCode,
supplierPrice: item.skuQuantityDetailList[k].supplierPrice / 100,
purchaseQuantity: item.skuQuantityDetailList[k].purchaseQuantity,
xiadan: item.skuQuantityDetailList[k].deliverQuantity,
skuNum: item.skuQuantityDetailList[k].realReceiveAuthenticQuantity}

13274
yarn.lock

File diff suppressed because it is too large Load Diff