【新增】1.temu条码组件 2.添加SKU
This commit is contained in:
@@ -8,14 +8,17 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@antv/g2plot": "^2.4.25",
|
||||
"@babel/standalone": "^7.25.8",
|
||||
"axios": "^1.4.0",
|
||||
"bi-vue-mindmap": "^0.6.12",
|
||||
"core-js": "^3.8.3",
|
||||
"crypto-js": "^4.0.0",
|
||||
"dayjs": "^1.11.9",
|
||||
"element-ui": "^2.15.13",
|
||||
"eval5": "^1.4.8",
|
||||
"file-saver": "^2.0.5",
|
||||
"html2canvas": "^1.4.1",
|
||||
"jsbarcode": "^3.11.6",
|
||||
"query-string": "^9.0.0",
|
||||
"spark-md5": "^3.0.2",
|
||||
"v-viewer": "^1.6.4",
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
@import "./styles.scss";
|
||||
|
||||
@font-face {
|
||||
font-family: 'iconfont'; /* project id 1995974 */
|
||||
font-family: 'iconfont';
|
||||
/* project id 1995974 */
|
||||
src: url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.eot');
|
||||
src: url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.eot?#iefix') format('embedded-opentype'),
|
||||
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.woff2') format('woff2'),
|
||||
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.woff') format('woff'),
|
||||
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.ttf') format('truetype'),
|
||||
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.svg#iconfont') format('svg');
|
||||
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.woff2') format('woff2'),
|
||||
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.woff') format('woff'),
|
||||
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.ttf') format('truetype'),
|
||||
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.svg#iconfont') format('svg');
|
||||
}
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: "iconfont";
|
||||
src: url('https://at.alicdn.com/t/c/font_4680344_rxl7gevvsys.woff2?t=1725970465332') format('woff2'),
|
||||
url('https://at.alicdn.com/t/c/font_4680344_rxl7gevvsys.woff?t=1725970465332') format('woff'),
|
||||
url('https://at.alicdn.com/t/c/font_4680344_rxl7gevvsys.ttf?t=1725970465332') format('truetype');
|
||||
url('https://at.alicdn.com/t/c/font_4680344_rxl7gevvsys.woff?t=1725970465332') format('woff'),
|
||||
url('https://at.alicdn.com/t/c/font_4680344_rxl7gevvsys.ttf?t=1725970465332') format('truetype');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
@@ -28,8 +29,10 @@
|
||||
}
|
||||
|
||||
html {
|
||||
line-height: 1; /* 1 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
line-height: 1;
|
||||
/* 1 */
|
||||
-webkit-text-size-adjust: 100%;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
body {
|
||||
@@ -43,14 +46,19 @@ h1 {
|
||||
|
||||
hr {
|
||||
-webkit-box-sizing: content-box;
|
||||
box-sizing: content-box; /* 1 */
|
||||
height: 0; /* 1 */
|
||||
overflow: visible; /* 2 */
|
||||
box-sizing: content-box;
|
||||
/* 1 */
|
||||
height: 0;
|
||||
/* 1 */
|
||||
overflow: visible;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
font-family: monospace, monospace;
|
||||
/* 1 */
|
||||
font-size: 1em;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
a {
|
||||
@@ -58,10 +66,13 @@ a {
|
||||
}
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: none; /* 1 */
|
||||
text-decoration: underline; /* 2 */
|
||||
border-bottom: none;
|
||||
/* 1 */
|
||||
text-decoration: underline;
|
||||
/* 2 */
|
||||
-webkit-text-decoration: underline dotted;
|
||||
text-decoration: underline dotted; /* 2 */
|
||||
text-decoration: underline dotted;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
b,
|
||||
@@ -72,8 +83,10 @@ strong {
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
font-family: monospace, monospace;
|
||||
/* 1 */
|
||||
font-size: 1em;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
small {
|
||||
@@ -105,14 +118,19 @@ input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit; /* 1 */
|
||||
font-size: 100%; /* 1 */
|
||||
line-height: 1.15; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
font-family: inherit;
|
||||
/* 1 */
|
||||
font-size: 100%;
|
||||
/* 1 */
|
||||
line-height: 1.15;
|
||||
/* 1 */
|
||||
margin: 0;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
button,
|
||||
input { /* 1 */
|
||||
input {
|
||||
/* 1 */
|
||||
overflow: visible;
|
||||
font-family: SJsuqian;
|
||||
}
|
||||
@@ -124,7 +142,8 @@ input::placeholder {
|
||||
}
|
||||
|
||||
button,
|
||||
select { /* 1 */
|
||||
select {
|
||||
/* 1 */
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
@@ -156,12 +175,18 @@ fieldset {
|
||||
|
||||
legend {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
display: table; /* 1 */
|
||||
max-width: 100%; /* 1 */
|
||||
padding: 0; /* 3 */
|
||||
white-space: normal; /* 1 */
|
||||
box-sizing: border-box;
|
||||
/* 1 */
|
||||
color: inherit;
|
||||
/* 2 */
|
||||
display: table;
|
||||
/* 1 */
|
||||
max-width: 100%;
|
||||
/* 1 */
|
||||
padding: 0;
|
||||
/* 3 */
|
||||
white-space: normal;
|
||||
/* 1 */
|
||||
}
|
||||
|
||||
progress {
|
||||
@@ -175,8 +200,10 @@ textarea {
|
||||
[type="checkbox"],
|
||||
[type="radio"] {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
box-sizing: border-box;
|
||||
/* 1 */
|
||||
padding: 0;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
@@ -185,8 +212,10 @@ textarea {
|
||||
}
|
||||
|
||||
[type="search"] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
outline-offset: -2px; /* 2 */
|
||||
-webkit-appearance: textfield;
|
||||
/* 1 */
|
||||
outline-offset: -2px;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
[type="search"]::-webkit-search-decoration {
|
||||
@@ -194,8 +223,10 @@ textarea {
|
||||
}
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button; /* 1 */
|
||||
font: inherit; /* 2 */
|
||||
-webkit-appearance: button;
|
||||
/* 1 */
|
||||
font: inherit;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
details {
|
||||
@@ -214,7 +245,10 @@ template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4 {
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4 {
|
||||
font-weight: normal;
|
||||
font-size: 14px;
|
||||
padding: 0;
|
||||
@@ -232,7 +266,8 @@ a {
|
||||
transition: all .3s ease;
|
||||
}
|
||||
|
||||
ul, li {
|
||||
ul,
|
||||
li {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
@@ -246,7 +281,8 @@ img {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
html, body {
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
}
|
||||
@@ -276,7 +312,8 @@ img {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-align, .flex-center {
|
||||
.flex-align,
|
||||
.flex-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -312,11 +349,13 @@ img {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.fade-enter-active, .fade-leave-active {
|
||||
.fade-enter-active,
|
||||
.fade-leave-active {
|
||||
transition: opacity .3s ease-in-out;
|
||||
}
|
||||
|
||||
.fade-enter, .fade-leave-to {
|
||||
.fade-enter,
|
||||
.fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
@@ -387,7 +426,8 @@ img {
|
||||
line-height: 17px;
|
||||
margin-bottom: 14px;
|
||||
font-size: 14px;
|
||||
font-family: SJsuqian;;
|
||||
font-family: SJsuqian;
|
||||
;
|
||||
|
||||
label {
|
||||
margin-right: 6px;
|
||||
@@ -437,7 +477,8 @@ img {
|
||||
background-color: #1FBAD6;
|
||||
}
|
||||
|
||||
.el-button--danger:focus, .el-button.el-button--danger.is-link:not(.is-disabled):hover {
|
||||
.el-button--danger:focus,
|
||||
.el-button.el-button--danger.is-link:not(.is-disabled):hover {
|
||||
color: #fff !important;
|
||||
border-color: #FA5555;
|
||||
background-color: #FA5555;
|
||||
@@ -478,17 +519,17 @@ img {
|
||||
.search-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0 16px 12px;
|
||||
margin: 0 25px 10px 0;
|
||||
|
||||
label {
|
||||
&>label {
|
||||
width: 80px;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 240px;
|
||||
// width: 240px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<section class="ai-dialog__wrapper">
|
||||
<el-dialog custom-class="ai-dialog" v-on="$listeners" v-bind="$attrs" :visible.sync="dialog">
|
||||
<el-dialog custom-class="ai-dialog" v-on="$listeners" v-bind="$attrs" :visible.sync="dialog" :close-on-click-modal="false">
|
||||
<div class="ai-dialog__header fill" slot="title" v-text="title"/>
|
||||
<div class="ai-dialog__content">
|
||||
<div class="ai-dialog__content--wrapper">
|
||||
|
||||
@@ -21,10 +21,6 @@
|
||||
<i class="iconfont"></i>
|
||||
<span>表格</span>
|
||||
</div>
|
||||
<div class="ep-draggable-item item" tid="defaultModule.html">
|
||||
<i class="iconfont"></i>
|
||||
<span>html</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="title">辅助元素</div>
|
||||
<div class="left-item__wrapper">
|
||||
@@ -171,8 +167,8 @@
|
||||
}
|
||||
},
|
||||
paperPopVisible: false,
|
||||
paperWidth: '80',
|
||||
paperHeight: '60'
|
||||
paperWidth: 200,
|
||||
paperHeight: 200
|
||||
}
|
||||
},
|
||||
|
||||
@@ -202,24 +198,30 @@
|
||||
|
||||
methods: {
|
||||
buildLeftElement() {
|
||||
// eslint-disable-next-line no-undef
|
||||
hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'))
|
||||
// eslint-disable-next-line no-undef
|
||||
$('#custom-provider').empty()
|
||||
// eslint-disable-next-line no-undef
|
||||
hiprint.PrintElementTypeManager.build($('#custom-provider'), 'customProvider')
|
||||
},
|
||||
|
||||
buildDesigner() {
|
||||
// eslint-disable-next-line no-undef
|
||||
$('#hiprint-printTemplate').empty()
|
||||
console.log(template)
|
||||
this.hiprintTemplate = newHiprintPrintTemplate('temulables', {
|
||||
template: template,
|
||||
settingContainer: '#PrintElementOptionSetting',
|
||||
fields: [{
|
||||
field: 'html',
|
||||
|
||||
}],
|
||||
onImageChooseClick: (target) => {
|
||||
let input = document.createElement('input')
|
||||
input.setAttribute('type', 'file')
|
||||
input.click()
|
||||
input.onchange = function () {
|
||||
var file = this.files[0]
|
||||
var reader = new FileReader()
|
||||
if (file) {
|
||||
var reader = new FileReader()
|
||||
reader.readAsDataURL(file)
|
||||
@@ -274,7 +276,7 @@
|
||||
}
|
||||
|
||||
const list = this.labels
|
||||
this.hiprintTemplate.print(list)
|
||||
this.hiprintTemplate.print(printData)
|
||||
},
|
||||
|
||||
elementToString(el) {
|
||||
@@ -286,12 +288,14 @@
|
||||
|
||||
savePdf() {
|
||||
const list = this.labels
|
||||
this.hiprintTemplate.toPdf(printData, '测试导出pdf')
|
||||
this.hiprintTemplate.toPdf(printData, '测试导出pdf').then(v => {
|
||||
console.log(v)
|
||||
})
|
||||
},
|
||||
|
||||
getHtml() {
|
||||
const list = this.labels
|
||||
this.html = this.elementToString(this.hiprintTemplate.getHtml(list)[0])
|
||||
this.html = this.elementToString(this.hiprintTemplate.getHtml(printData))
|
||||
|
||||
console.log(this.html)
|
||||
|
||||
|
||||
@@ -5,19 +5,42 @@ export const customProvider = function (options) {
|
||||
context.addPrintElementTypes('customProvider', [
|
||||
new hiprint.PrintElementTypeGroup('', [
|
||||
{
|
||||
tid: 'providerModule1.date',
|
||||
title: '业务日期',
|
||||
data: '2020-01-01',
|
||||
type: 'text',
|
||||
tid: 'providerModule1.html',
|
||||
title: 'temu条码',
|
||||
data: 'XS888888888',
|
||||
type: 'html',
|
||||
formatter: function (title, options, templateData) {
|
||||
console.log(options, templateData)
|
||||
|
||||
setTimeout(() => {
|
||||
// eslint-disable-next-line no-undef
|
||||
JsBarcode("#barcode", "1234567890", {
|
||||
format: "code128", // 条形码类型
|
||||
width: 2, // 条的宽度
|
||||
height: 50, // 条形码的高度
|
||||
});
|
||||
})
|
||||
return `
|
||||
<div class="temuBarCode">
|
||||
<div class="temuBarCode-top">
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">(AA+AAA)*20PCS</div>
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">AA 20PCS+AAA 20PCS</div>
|
||||
</div>
|
||||
<div class="temuBarCode-middle">
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content temuBarCode-code">
|
||||
<svg id="barcode"></svg>
|
||||
</div>
|
||||
</div>
|
||||
<div class="temuBarCode-bottom">
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">1034130097</div>
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">Made in China</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
},
|
||||
options: {
|
||||
field: 'date',
|
||||
testData: '2020-01-01',
|
||||
height: 16,
|
||||
fontSize: 6.75,
|
||||
fontWeight: '700',
|
||||
textAlign: 'left',
|
||||
textContentVerticalAlign: 'middle',
|
||||
hideTitle: true
|
||||
width: 316,
|
||||
height: 120
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -21,6 +21,24 @@ Vue.prototype.$base = "https://seller.kuajingmaihuo.com"
|
||||
Object.keys(utils).forEach(v => Vue.prototype[`$${v}`] = utils[v])
|
||||
|
||||
Vue.prototype.$http = instance
|
||||
utils.initWindow()
|
||||
Vue.directive('throttle', {
|
||||
bind: function (el, obj) {
|
||||
let timerId = null
|
||||
let flag = true
|
||||
|
||||
el.addEventListener('input', function () {
|
||||
if (!flag) return
|
||||
|
||||
flag = false
|
||||
timerId && clearTimeout(timerId)
|
||||
timerId = setTimeout(function () {
|
||||
flag = true
|
||||
obj.value()
|
||||
}, 800)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
new Vue({
|
||||
store,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import request from '../api'
|
||||
import store from '../store'
|
||||
import { Message } from 'element-ui'
|
||||
import JsBarcode from 'jsbarcode'
|
||||
import { Interpreter } from 'eval5'
|
||||
import { transform } from "@babel/standalone"
|
||||
|
||||
const dict = {
|
||||
url: "/api/dictionary/queryValsByCodeList",
|
||||
@@ -118,11 +121,26 @@ const sleepSync = (milliseconds) => {
|
||||
return new Promise(resolve => setTimeout(resolve, milliseconds));
|
||||
}
|
||||
|
||||
const initWindow = () => {
|
||||
const transformCode = (codeStr) => {
|
||||
return transform(codeStr, { presets: ['env'] }).code
|
||||
}
|
||||
const interpreter = new Interpreter(window, {
|
||||
timeout: 1000,
|
||||
})
|
||||
|
||||
window.eval = code => {
|
||||
return interpreter.evaluate(transformCode(code))
|
||||
}
|
||||
window.JsBarcode = JsBarcode
|
||||
}
|
||||
|
||||
export default {
|
||||
dict,
|
||||
dateUtil,
|
||||
sleepSync,
|
||||
userCheck
|
||||
userCheck,
|
||||
initWindow
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -290,8 +290,6 @@ export default {
|
||||
},
|
||||
|
||||
created() {
|
||||
window.eval = () => {
|
||||
}
|
||||
const devVersion = require('../manifest.development.json').version
|
||||
const prodVersion = require('../manifest.production.json').version
|
||||
this.version = process.env.NODE_ENV === 'production' ? prodVersion : devVersion
|
||||
@@ -392,7 +390,7 @@ export default {
|
||||
}
|
||||
await detalAction(res);
|
||||
console.log("--fileList--", fileList)
|
||||
},
|
||||
},
|
||||
gotoKefu() {
|
||||
window.open('https://work.weixin.qq.com/kfid/kfcaa4208f661131eba', '_blank')
|
||||
},
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
style="margin-top: 8px;"
|
||||
@getList="getList">
|
||||
@getList="getList"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column slot="productName" width="300px" :show-overflow-tooltip='true' label="商品名称" fixed="left">
|
||||
<template slot-scope="scope">
|
||||
<div>
|
||||
@@ -45,22 +46,79 @@
|
||||
title="添加SKU"
|
||||
width="1400px"
|
||||
@confirm="onConfirm">
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<el-select v-model="skuSearch.mallId" placeholder="请选择店铺" size="small" @change="onMallChange">
|
||||
<el-option
|
||||
v-for="item in $store.state.mallList"
|
||||
:key="item.mallId"
|
||||
:label="item.mallName"
|
||||
:value="item.mallId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #right>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<div class="search-item__wrapper">
|
||||
<div class="left">
|
||||
<div class="search-item">
|
||||
<label>添加方式:</label>
|
||||
<el-radio-group v-model="addType" size="small" @change="onSearchRest">
|
||||
<el-radio-button label="1">按类目添加</el-radio-button>
|
||||
<el-radio-button label="2">按SKC添加</el-radio-button>
|
||||
<el-radio-button label="3">按SKU添加</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label>店铺:</label>
|
||||
<el-select v-model="skuSearch.mallId" 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>
|
||||
<div class="right"></div>
|
||||
</div>
|
||||
<div class="search-item__wrapper">
|
||||
<div class="left">
|
||||
<div class="search-item" v-show="addType === '1'">
|
||||
<label>商品分类:</label>
|
||||
<el-cascader
|
||||
style="width: 280px;"
|
||||
v-model="targetCatId"
|
||||
:props="props"
|
||||
size="small"
|
||||
filterable
|
||||
:show-all-levels="false"
|
||||
collapse-tags
|
||||
clearable>
|
||||
</el-cascader>
|
||||
<el-button style="margin-left: 10px;" @click="onCateChange" size="small" :disabled="!skuSearch.mallId" :loading="isLoading">查询</el-button>
|
||||
</div>
|
||||
<div class="search-item" v-show="addType === '2'">
|
||||
<label>SKC:</label>
|
||||
<el-input
|
||||
v-model="skuReqParams.SKC"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
v-throttle="() => {getSkuList()}"
|
||||
placeholder="多个查询请用户逗号分割"
|
||||
clearable
|
||||
@clear="getSkuList()"
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
<el-button style="margin-left: 10px;" @click="getSkuList" size="small" :disabled="!skuSearch.mallId" :loading="isLoading">查询</el-button>
|
||||
</div>
|
||||
<div class="search-item" v-show="addType === '3'">
|
||||
<label>SKU:</label>
|
||||
<el-input
|
||||
v-if="addType === '3'"
|
||||
v-model="skuReqParams.SKU"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
v-throttle="() => {getSkuList()}"
|
||||
placeholder="多个查询请用户逗号分割"
|
||||
clearable
|
||||
@clear="getSkuList()"
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
<el-button style="margin-left: 10px;" @click="getSkuList" size="small" :disabled="!skuSearch.mallId" :loading="isLoading">查询</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ai-table
|
||||
height="400"
|
||||
height="370"
|
||||
:tableData="skuList"
|
||||
:col-configs="colConfigs"
|
||||
:total="skuTotal"
|
||||
@@ -69,7 +127,8 @@
|
||||
style="margin-top: 8px;"
|
||||
@getList="getSkuList"
|
||||
:pageSizes="[10, 20, 50, 100, 500, 1000]"
|
||||
v-loading="isLoading">
|
||||
v-loading="isLoading"
|
||||
:isShowPagination="false">
|
||||
<el-table-column slot="productName" width="300px" :show-overflow-tooltip="true" label="商品名称" fixed="left">
|
||||
<template slot-scope="scope">
|
||||
<div>
|
||||
@@ -87,11 +146,12 @@
|
||||
<script>
|
||||
import { sendChromeAPIMessage } from '@/api/chromeApi'
|
||||
export default {
|
||||
name: 'Template',
|
||||
name: 'SkuManage',
|
||||
|
||||
data () {
|
||||
return {
|
||||
colConfigs: [
|
||||
{ type: 'selection' },
|
||||
// { slot: 'productName', label: '商品名称', width: '300px', align: 'left', fixed: 'left' },
|
||||
// { prop: 'category', label: '分类', width: '140px', align: 'left', fixed: 'left' },
|
||||
{ prop: 'mallName', label: '店铺名称', align: 'left' },
|
||||
@@ -118,9 +178,38 @@
|
||||
isShow: false,
|
||||
skuReqParams: {
|
||||
page: 1,
|
||||
pageSize: 100
|
||||
pageSize: 100,
|
||||
SKC: '',
|
||||
SKU: ''
|
||||
},
|
||||
isLoading: false
|
||||
isLoading: false,
|
||||
addType: '1',
|
||||
props: {
|
||||
value: 'catId',
|
||||
label: 'catName',
|
||||
multiple: true,
|
||||
checkStrictly: true,
|
||||
lazy: true,
|
||||
lazyLoad (value, resolve) {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-anniston-mms/category/children/list',
|
||||
needMallId: true,
|
||||
data: {
|
||||
parentCatId: value.level === 0 ? '' : value.value
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.errorCode === 1000000) {
|
||||
resolve(res.result.categoryNodeVOS.map(v => {
|
||||
return {
|
||||
...v,
|
||||
leaf: v.isLeaf
|
||||
}
|
||||
}))
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
targetCatId: []
|
||||
}
|
||||
},
|
||||
|
||||
@@ -143,15 +232,78 @@
|
||||
this.$router.push('/addLabelsTemplate')
|
||||
},
|
||||
|
||||
requestSKUList () {
|
||||
sendChromeAPIMessage({
|
||||
onSearchRest() {
|
||||
this.skuReqParams.SKC = ''
|
||||
this.skuReqParams.SKU = ''
|
||||
},
|
||||
|
||||
handleSelectionChange(e) {
|
||||
console.log(e)
|
||||
},
|
||||
|
||||
getSKCList(catIds, page) {
|
||||
return new Promise(resolve => {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-visage-mms/product/skc/pageQuery',
|
||||
needMallId: true,
|
||||
mallId: this.skuSearch.mallId,
|
||||
anti: true,
|
||||
data: {
|
||||
page: 1,
|
||||
pageSize: 200,
|
||||
catIds: catIds
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.errorCode == 1000000) {
|
||||
resolve({
|
||||
list: res.result.pageItems.map(v => v.productSkcId),
|
||||
isHasNext: page * 200 < res.result.total
|
||||
})
|
||||
} else {
|
||||
resolve({ list: [], isHasNext: false })
|
||||
}
|
||||
}).catch(() => {
|
||||
resolve({ list: [], isHasNext: false })
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
async onCateChange() {
|
||||
let page = 1
|
||||
let list = []
|
||||
let isHasNext = true
|
||||
this.isLoading = true
|
||||
while (isHasNext) {
|
||||
const result = await this.getSKCList([].concat(this.targetCatId.flat()), page)
|
||||
page = page + 1
|
||||
isHasNext = result.isHasNext ? true : false
|
||||
list.push(...result.list)
|
||||
|
||||
await this.$sleepSync(5000)
|
||||
}
|
||||
|
||||
const skcList = [...new Set(list)]
|
||||
const len = Math.ceil(skcList.length / 100)
|
||||
for (let i = 0; i < len; i++) {
|
||||
this.skuReqParams.page = 1
|
||||
this.skuReqParams.SKC = [...new Set(list)].slice(i * 100, i * 100 + 100).join(',')
|
||||
await this.requestSKUList()
|
||||
await this.$sleepSync(2000)
|
||||
}
|
||||
},
|
||||
|
||||
requestSKUList() {
|
||||
this.isLoading = true
|
||||
return sendChromeAPIMessage({
|
||||
url: 'bg-visage-mms/labelcode/pageQuery',
|
||||
needMallId: true,
|
||||
mallId: this.skuSearch.mallId,
|
||||
anti: true,
|
||||
data: {
|
||||
page: this.skuSearch.size > 100 ? this.skuReqParams.page : this.skuSearch.current,
|
||||
pageSize: this.skuSearch.size > 100 ? 100 : this.skuSearch.size
|
||||
page: this.skuReqParams.page,
|
||||
pageSize: 200,
|
||||
productSkcIdList: (['2', '1'].includes(this.addType)) ? this.skuReqParams.SKC.split(',') : [],
|
||||
productSkuIdList: this.addType === '3' ? this.skuReqParams.SKU.split(',') : []
|
||||
}
|
||||
}).then(async (res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
@@ -170,10 +322,10 @@
|
||||
this.skuTotal = res.result.total
|
||||
this.skuList.push(...list)
|
||||
|
||||
if (this.skuSearch.size > 100 && (res.result.total > this.skuList.length)) {
|
||||
if (res.result.total > this.skuList.length) {
|
||||
this.skuReqParams.page++
|
||||
await this.$sleepSync(5000)
|
||||
this.requestSKUList()
|
||||
await this.requestSKUList()
|
||||
} else {
|
||||
this.isLoading = false
|
||||
}
|
||||
@@ -181,23 +333,6 @@
|
||||
})
|
||||
},
|
||||
|
||||
onMallChange (e) {
|
||||
if (!e) {
|
||||
this.skuList = []
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
this.$userCheck(this.skuSearch.mallId).then(() => {
|
||||
this.skuList = []
|
||||
this.skuReqParams.page = 1
|
||||
this.isLoading = true
|
||||
this.requestSKUList()
|
||||
}).catch(() => {
|
||||
this.skuSearch.mallId = ''
|
||||
})
|
||||
},
|
||||
|
||||
getSkuList () {
|
||||
if (!this.skuSearch.mallId) {
|
||||
return this.$message.error('请选择店铺')
|
||||
@@ -235,4 +370,16 @@
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.Template {
|
||||
.search-item__wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
&>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
31
yarn.lock
31
yarn.lock
@@ -1051,6 +1051,11 @@
|
||||
dependencies:
|
||||
regenerator-runtime "^0.14.0"
|
||||
|
||||
"@babel/standalone@^7.25.8":
|
||||
version "7.25.8"
|
||||
resolved "https://registry.npmmirror.com/@babel/standalone/-/standalone-7.25.8.tgz#054a0c7c28275527f05cba4c17fe45cab8e9c638"
|
||||
integrity sha512-UvRanvLCGPRscJ5Rw9o6vUBS5P+E+gkhl6eaokrIN+WM1kUkmj254VZhyihFdDZVDlI3cPcZoakbJJw24QPISw==
|
||||
|
||||
"@babel/template@^7.25.0", "@babel/template@^7.25.7":
|
||||
version "7.25.7"
|
||||
resolved "https://registry.npmmirror.com/@babel/template/-/template-7.25.7.tgz#27f69ce382855d915b14ab0fe5fb4cbf88fa0769"
|
||||
@@ -1387,6 +1392,13 @@
|
||||
resolved "https://registry.npmmirror.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad"
|
||||
integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==
|
||||
|
||||
"@types/acorn@^4.0.5":
|
||||
version "4.0.6"
|
||||
resolved "https://registry.npmmirror.com/@types/acorn/-/acorn-4.0.6.tgz#d61ca5480300ac41a7d973dd5b84d0a591154a22"
|
||||
integrity sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==
|
||||
dependencies:
|
||||
"@types/estree" "*"
|
||||
|
||||
"@types/body-parser@*":
|
||||
version "1.19.5"
|
||||
resolved "https://registry.npmmirror.com/@types/body-parser/-/body-parser-1.19.5.tgz#04ce9a3b677dc8bd681a17da1ab9835dc9d3ede4"
|
||||
@@ -1435,6 +1447,11 @@
|
||||
resolved "https://registry.npmmirror.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50"
|
||||
integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==
|
||||
|
||||
"@types/estree@0.0.41":
|
||||
version "0.0.41"
|
||||
resolved "https://registry.npmmirror.com/@types/estree/-/estree-0.0.41.tgz#fd90754150b57432b72bf560530500597ff04421"
|
||||
integrity sha512-rIAmXyJlqw4KEBO7+u9gxZZSQHaCNnIzYrnNmYVpgfJhxTqO0brCX0SYpqUTkVI5mwwUwzmtspLBGBKroMeynA==
|
||||
|
||||
"@types/express-serve-static-core@*", "@types/express-serve-static-core@^5.0.0":
|
||||
version "5.0.0"
|
||||
resolved "https://registry.npmmirror.com/@types/express-serve-static-core/-/express-serve-static-core-5.0.0.tgz#91f06cda1049e8f17eeab364798ed79c97488a1c"
|
||||
@@ -2103,7 +2120,7 @@ acorn@8.0.4:
|
||||
resolved "https://registry.npmmirror.com/acorn/-/acorn-8.0.4.tgz#7a3ae4191466a6984eee0fe3407a4f3aa9db8354"
|
||||
integrity sha512-XNP0PqF1XD19ZlLKvB7cMmnZswW4C/03pRHgirB30uSJTaS3A3V1/P4sS3HPvFmjoriPCJQs+JDSbm4bL1TxGQ==
|
||||
|
||||
acorn@^7.4.0:
|
||||
acorn@^7.1.0, acorn@^7.4.0:
|
||||
version "7.4.1"
|
||||
resolved "https://registry.npmmirror.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
|
||||
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
|
||||
@@ -3989,6 +4006,16 @@ etag@~1.8.1:
|
||||
resolved "https://registry.npmmirror.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
|
||||
integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==
|
||||
|
||||
eval5@^1.4.8:
|
||||
version "1.4.8"
|
||||
resolved "https://registry.npmmirror.com/eval5/-/eval5-1.4.8.tgz#efa3f1da7dfa7e152b58b9571e5aa415b01a556b"
|
||||
integrity sha512-sdc04TAeklUHrITxBWksrDsDBWqAvYs9VCS2cpSHrSqzTdva4JkILV+x7kVlyoUqp/g7kMyGS+4RMYgfkGciAw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.8.4"
|
||||
"@types/acorn" "^4.0.5"
|
||||
"@types/estree" "0.0.41"
|
||||
acorn "^7.1.0"
|
||||
|
||||
event-pubsub@4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.npmmirror.com/event-pubsub/-/event-pubsub-4.3.0.tgz#f68d816bc29f1ec02c539dc58c8dd40ce72cb36e"
|
||||
@@ -5134,7 +5161,7 @@ js-yaml@^3.13.1:
|
||||
argparse "^1.0.7"
|
||||
esprima "^4.0.0"
|
||||
|
||||
jsbarcode@^3.11.5:
|
||||
jsbarcode@^3.11.5, jsbarcode@^3.11.6:
|
||||
version "3.11.6"
|
||||
resolved "https://registry.npmmirror.com/jsbarcode/-/jsbarcode-3.11.6.tgz#96e8fbc3395476e162982a6064b98a09b5ea02c0"
|
||||
integrity sha512-G5TKGyKY1zJo0ZQKFM1IIMfy0nF2rs92BLlCz+cU4/TazIc4ZH+X1GYeDRt7TKjrYqmPfTjwTBkU/QnQlsYiuA==
|
||||
|
||||
Reference in New Issue
Block a user