1
This commit is contained in:
55930
node_modules/vue-plugin-hiprint/dist/vue-plugin-hiprint.js
generated
vendored
55930
node_modules/vue-plugin-hiprint/dist/vue-plugin-hiprint.js
generated
vendored
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@ import store from '@/store'
|
||||
|
||||
|
||||
var instance = axios.create({
|
||||
baseURL: process.env.NODE_ENV === 'production' ? 'http://124.71.2.127:8888' : 'http://124.71.2.127:8888',
|
||||
baseURL: process.env.NODE_ENV === 'production' ? 'http://124.71.2.127:8888' : 'http://124.71.2.127:10248',
|
||||
timeout: 50000,
|
||||
validateStatus: function (status) {
|
||||
return status < 500
|
||||
|
||||
@@ -44,42 +44,18 @@
|
||||
<span>素材</span>
|
||||
</div>
|
||||
<div class="left-item__wrapper">
|
||||
<el-popover
|
||||
title="图片素材(点击添加)"
|
||||
trigger="hover">
|
||||
<div
|
||||
class="item"
|
||||
slot="reference"
|
||||
style="cursor: pointer;">
|
||||
style="cursor: pointer;"
|
||||
@click="search.type = 1, search.current = 1, isShowImage = true, getConfig()">
|
||||
<div>图片素材</div>
|
||||
</div>
|
||||
<div class="print-images">
|
||||
<img
|
||||
:src="item.imgUrl"
|
||||
v-for="(item, index) in images"
|
||||
:key="index"
|
||||
:title="item.remark"
|
||||
@click="addImage(item.imgUrl)" />
|
||||
</div>
|
||||
</el-popover>
|
||||
<el-popover
|
||||
title="图片素材(点击添加)"
|
||||
trigger="hover">
|
||||
<div
|
||||
class="item"
|
||||
slot="reference"
|
||||
style="cursor: pointer;">
|
||||
style="cursor: pointer;"
|
||||
@click="search.type = 0, search.current = 1, isShowImage = true, getConfig()">
|
||||
<div>文字素材</div>
|
||||
</div>
|
||||
<div class="print-images">
|
||||
<p
|
||||
@click="addText(item.contents)"
|
||||
v-for="(item, index) in contents"
|
||||
:key="index">
|
||||
{{ item.contents }}
|
||||
</p>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
<div class="title">
|
||||
<span>动态数据(如日期)</span>
|
||||
@@ -119,15 +95,6 @@
|
||||
<el-button slot="reference" size="small" :type="'other' == curPaperType ? 'primary' : ''">自定义纸张</el-button>
|
||||
</el-popover>
|
||||
</el-button-group>
|
||||
<!-- <div class="scale">
|
||||
<el-button @click="changeScale(false)" size="small">
|
||||
<el-icon size="18"><ZoomOut /></el-icon>
|
||||
</el-button>
|
||||
<div style="margin: 0 4px; width: 40px">{{ (scaleValue * 100).toFixed(0) }}%</div>
|
||||
<el-button @click="changeScale(true)" size="small">
|
||||
<el-icon size="18"><ZoomIn /></el-icon>
|
||||
</el-button>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="center-wrapper">
|
||||
@@ -144,6 +111,61 @@
|
||||
<el-button @click="isShowPreview = false">取消</el-button>
|
||||
</div>
|
||||
</ai-dialog>
|
||||
<ai-dialog :visible.sync="isShowImage" title="图片/文字素材" width="960" customFooter>
|
||||
<el-select v-model="search.type" placeholder="请选择图片/文字素材" size="small" @change="search.current = 1, getConfig()">
|
||||
<el-option label="图片素材" :value="1"></el-option>
|
||||
<el-option label="文字素材" :value="0"></el-option>
|
||||
</el-select>
|
||||
<ai-table
|
||||
v-if="search.type === 1"
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
style="margin-top: 8px;"
|
||||
height="400"
|
||||
@getList="getConfig">
|
||||
<el-table-column slot="image" label="图片" align="left">
|
||||
<template v-slot="{ row }">
|
||||
<el-image
|
||||
v-if="search.type === 1"
|
||||
style="width: 80px; height: 80px"
|
||||
:src="row.imgUrl"
|
||||
:preview-src-list="[row.imgUrl]">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column slot="options" label="操作" align="center">
|
||||
<template v-slot="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button type="text" @click="row.type === '1' ? addImage(row.imgUrl) : addText(row.contents), isShowImage = false">添加</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
<ai-table
|
||||
v-if="search.type === 0"
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
style="margin-top: 8px;"
|
||||
height="400"
|
||||
@getList="getConfig">
|
||||
<el-table-column slot="options" label="操作" align="center">
|
||||
<template v-slot="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button type="text" @click="row.type === '1' ? addImage(row.imgUrl) : addText(row.contents), isShowImage = false">添加</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
<div class="dialog-footer" slot="footer">
|
||||
<el-button @click="isShowImage = false">取消</el-button>
|
||||
</div>
|
||||
</ai-dialog>
|
||||
<ai-dialog
|
||||
:visible.sync="isShowDynamicForm"
|
||||
title="动态数据"
|
||||
@@ -233,29 +255,13 @@
|
||||
height: 200
|
||||
},
|
||||
paperTypes: {
|
||||
'A3': {
|
||||
width: 420,
|
||||
height: 296.6
|
||||
'1:1': {
|
||||
width: 200,
|
||||
height: 200
|
||||
},
|
||||
'A4': {
|
||||
width: 210,
|
||||
height: 296.6
|
||||
},
|
||||
'A5': {
|
||||
width: 210,
|
||||
height: 147.6
|
||||
},
|
||||
'B3': {
|
||||
width: 500,
|
||||
height: 352.6
|
||||
},
|
||||
'B4': {
|
||||
width: 250,
|
||||
height: 352.6
|
||||
},
|
||||
'B5': {
|
||||
width: 250,
|
||||
height: 175.6
|
||||
'1:1.2': {
|
||||
width: 200,
|
||||
height: 240
|
||||
}
|
||||
},
|
||||
paperPopVisible: false,
|
||||
@@ -267,7 +273,15 @@
|
||||
dynamicFromList: [],
|
||||
panel: null,
|
||||
contents: [],
|
||||
images: []
|
||||
images: [],
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
type: 1
|
||||
},
|
||||
isShowImage: false,
|
||||
tableData: [],
|
||||
total: 0
|
||||
}
|
||||
},
|
||||
|
||||
@@ -275,7 +289,6 @@
|
||||
template: {
|
||||
handler(value) {
|
||||
if (value && this.hiprintTemplate && !this.isPrint) {
|
||||
console.log(value)
|
||||
const config = value.panels[0]
|
||||
this.hiprintTemplate.update(value)
|
||||
this.curPaper = {type: 'other', width: config.width, height: config.height}
|
||||
@@ -302,6 +315,20 @@
|
||||
}
|
||||
}
|
||||
return type
|
||||
},
|
||||
|
||||
colConfigs () {
|
||||
if (this.search.type === 1) {
|
||||
return [
|
||||
{ slot: 'image' },
|
||||
{ prop: 'remark', label: '描述', align: 'center' }
|
||||
]
|
||||
}
|
||||
|
||||
return [
|
||||
{ prop: 'contents', label: '文本', align: 'center' },
|
||||
{ prop: 'remark', label: '描述', align: 'center' }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -337,10 +364,10 @@
|
||||
},
|
||||
|
||||
getConfig() {
|
||||
this.$http.post(`/api/material/getPage?page=1&size=-1`).then(res => {
|
||||
this.$http.post(`/api/material/getPage?current=${this.search.current}&size=${this.search.size}&type=${this.search.type}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.images = res.data.records.filter(v => v.type === '1')
|
||||
this.contents = res.data.records.filter(v => v.type === '0')
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -352,7 +379,8 @@
|
||||
left: 70.5,
|
||||
top: 58.5,
|
||||
src: src,
|
||||
widthHeightSync: true
|
||||
width: 100,
|
||||
height: 100
|
||||
}
|
||||
})
|
||||
const el = this.hiprintTemplate.printPanels[0].printElements.at(-1)
|
||||
@@ -372,6 +400,7 @@
|
||||
width: 140,
|
||||
height: 20,
|
||||
coordinateSync: true,
|
||||
contentPaddingLeft: 5.25,
|
||||
textContentVerticalAlign: 'middle',
|
||||
widthHeightSync: true,
|
||||
hideTitle: true,
|
||||
@@ -621,6 +650,8 @@
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
left: 0!important;
|
||||
top: 0!important;
|
||||
width: 100px;
|
||||
margin-bottom: 10px;
|
||||
margin-right: 10px;
|
||||
|
||||
@@ -13,10 +13,10 @@ export const customProvider = function (options) {
|
||||
const elId = options.elId || 'barCode-' + new Date().getTime()
|
||||
const codeWidth = parseInt((options.width - 22) * 0.85)
|
||||
let printData = {
|
||||
labelCode: 96778555251,
|
||||
productSkuId: 6606980005,
|
||||
skuExtCode: 'AAA1100mWh-orange',
|
||||
skuSpecName: '8pcs'
|
||||
labelCode: 123456789,
|
||||
productSkuId: `XXXXXXXXXXXXXX`,
|
||||
skuExtCode: 'XXXXXXXXXXXXXX',
|
||||
skuSpecName: 'XXXXX'
|
||||
}
|
||||
|
||||
options.elId = `${elId}`
|
||||
@@ -43,7 +43,7 @@ export const customProvider = function (options) {
|
||||
$(`body>#codewrapper-${elId}`).remove()
|
||||
// eslint-disable-next-line no-undef
|
||||
const resizeObserver = new ResizeObserver(() => {
|
||||
JsBarcode('#'+ elId, printData.labelCode, {
|
||||
JsBarcode('#' + elId, printData.labelCode, {
|
||||
format: "CODE128B",
|
||||
width: 2,
|
||||
height: parseInt(hinnn.pt.toPx(options.height - 22).toString()) * 0.6,
|
||||
@@ -61,8 +61,8 @@ export const customProvider = function (options) {
|
||||
var html = `
|
||||
<div class="temuBarCode" id="temuBarCode-${elId}">
|
||||
<div class="temuBarCode-top">
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">${ printData.skuExtCode }</div>
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">${ printData.skuSpecName }</div>
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">${printData.skuExtCode || printData.productSkcId}</div>
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">${printData.skuSpecName}</div>
|
||||
</div>
|
||||
<div class="temuBarCode-middle">
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content temuBarCode-code" style="width: 100%">
|
||||
@@ -70,7 +70,7 @@ export const customProvider = function (options) {
|
||||
</div>
|
||||
</div>
|
||||
<div class="temuBarCode-bottom">
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">${ printData.productSkuId }</div>
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">${printData.productSkuId}</div>
|
||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">Made in China</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -85,37 +85,37 @@ export const customProvider = function (options) {
|
||||
printElementType: {
|
||||
}
|
||||
},
|
||||
{
|
||||
tid: 'providerModule1.barcode',
|
||||
title: '条形码',
|
||||
data: 'XS888888888',
|
||||
type: 'text',
|
||||
options: {
|
||||
field: 'barcode',
|
||||
testData: 'XS888888888',
|
||||
height: 32,
|
||||
fontSize: 12,
|
||||
lineHeight: 18,
|
||||
textAlign: 'left',
|
||||
textType: 'barcode',
|
||||
hideTitle: false
|
||||
}
|
||||
},
|
||||
{
|
||||
tid: 'providerModule1.qrcode',
|
||||
title: '二维码',
|
||||
data: 'XS888888888',
|
||||
type: 'text',
|
||||
options: {
|
||||
field: '',
|
||||
testData: '',
|
||||
height: 32,
|
||||
fontSize: 12,
|
||||
lineHeight: 18,
|
||||
textType: 'qrcode',
|
||||
hideTitle: false
|
||||
}
|
||||
},
|
||||
// {
|
||||
// tid: 'providerModule1.barcode',
|
||||
// title: '条形码',
|
||||
// data: 'XS888888888',
|
||||
// type: 'text',
|
||||
// options: {
|
||||
// field: 'barcode',
|
||||
// testData: 'XS888888888',
|
||||
// height: 32,
|
||||
// fontSize: 12,
|
||||
// lineHeight: 18,
|
||||
// textAlign: 'left',
|
||||
// textType: 'barcode',
|
||||
// hideTitle: false
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// tid: 'providerModule1.qrcode',
|
||||
// title: '二维码',
|
||||
// data: 'XS888888888',
|
||||
// type: 'text',
|
||||
// options: {
|
||||
// field: '',
|
||||
// testData: '',
|
||||
// height: 32,
|
||||
// fontSize: 12,
|
||||
// lineHeight: 18,
|
||||
// textType: 'qrcode',
|
||||
// hideTitle: false
|
||||
// }
|
||||
// },
|
||||
{
|
||||
tid: 'providerModule1.image',
|
||||
title: '图片',
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
<i class="el-icon-s-data"></i>
|
||||
<span slot="title">数据统计</span>
|
||||
</el-menu-item> -->
|
||||
<el-submenu index="/labelsTemplate" v-if="$store.state.userInfo.phone == '18571466720'">
|
||||
<el-submenu index="/labelsTemplate">
|
||||
<template slot="title">
|
||||
<i class="el-icon-s-goods"></i>
|
||||
<div slot="title" style="display: inline-block;">
|
||||
|
||||
@@ -9,15 +9,20 @@
|
||||
<div class="search-item__wrapper">
|
||||
<div class="left">
|
||||
<div class="search-item">
|
||||
<label>添加方式:</label>
|
||||
<el-radio-group v-model="addType" size="small">
|
||||
<label>打印方式:</label>
|
||||
<el-radio-group v-model="addType" size="small" @click="lableList = [], search.productSkuId = '', search.productSkcId = ''">
|
||||
<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>
|
||||
</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-select v-model="search.mallId" placeholder="请选择店铺" size="small">
|
||||
<el-option
|
||||
v-for="item in $store.state.mallList"
|
||||
@@ -26,30 +31,10 @@
|
||||
:value="item.mallId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button style="margin-left: 10px;" size="small" :disabled="!search.mallId" :loading="isLoading" @click="searchSkuList">查询</el-button>
|
||||
</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-button style="margin-left: 10px;" size="small" :disabled="!search.mallId" :loading="isLoading">查询</el-button>
|
||||
</div>
|
||||
<div class="search-item" v-show="addType === '2'">
|
||||
<label>SKC:</label>
|
||||
<el-input
|
||||
v-model="search.productSkcId"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
placeholder="多个查询请用户逗号分割"
|
||||
clearable
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
<el-button style="margin-left: 10px;" @click="getList" size="small" :loading="isLoading">查询</el-button>
|
||||
</div>
|
||||
<div class="search-item" v-show="addType === '3'">
|
||||
<label>SKU:</label>
|
||||
<div class="search-item" v-show="addType === '2' || addType === '3'">
|
||||
<label>{{ addType === '2' ? 'SKC:' : 'SKU:' }}</label>
|
||||
<el-input
|
||||
v-if="addType === '3'"
|
||||
v-model="search.productSkuId"
|
||||
@@ -59,6 +44,29 @@
|
||||
placeholder="多个查询请用户逗号分割"
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
<el-input
|
||||
v-else
|
||||
v-model="search.productSkcId"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
placeholder="多个查询请用户逗号分割"
|
||||
clearable
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
<el-select
|
||||
clearable
|
||||
v-model="search.templateId"
|
||||
placeholder="请选择模板"
|
||||
size="small"
|
||||
@change="getList"
|
||||
style="margin-left: 10px;">
|
||||
<el-option
|
||||
v-for="item in templateList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button style="margin-left: 10px;" @click="getList" size="small" :loading="isLoading">查询</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -69,7 +77,6 @@
|
||||
:isShowPagination="false"
|
||||
:height="height"
|
||||
@getList="() => {}"
|
||||
@selection-change="handleSelectionChange"
|
||||
:loading="isLoading">
|
||||
<el-table-column slot="options" label="操作" align="center" fixed="right" width="140px">
|
||||
<template v-slot="{ row }">
|
||||
@@ -81,6 +88,17 @@
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
<Print ref="printRef" :isPrint="true"></Print>
|
||||
<ai-dialog
|
||||
:visible.sync="isShow"
|
||||
title="打印数量"
|
||||
width="890px"
|
||||
@confirm="onConfirm">
|
||||
<el-form class="ai-form" :model="form" ref="form" label-width="80px">
|
||||
<el-form-item label="标签名称" style="width: 100%;" prop="count" :rules="[{ required: true, message: '请输入打印数量', trigger: 'change' }]">
|
||||
<el-input-number v-model="form.count" :min="1" :max="500" label="请输入打印数量"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ai-dialog>
|
||||
</template>
|
||||
</ai-list>
|
||||
</template>
|
||||
@@ -113,13 +131,21 @@
|
||||
productSkuId: '',
|
||||
productSkcId: '',
|
||||
page: 1,
|
||||
size: -1
|
||||
size: -1,
|
||||
templateId: ''
|
||||
},
|
||||
addType: '1',
|
||||
isLoading: false,
|
||||
lableList: [],
|
||||
height: 600,
|
||||
skuChoosedList: []
|
||||
skuChoosedList: [],
|
||||
isShow: false,
|
||||
form: {
|
||||
count: 1
|
||||
},
|
||||
printData: [],
|
||||
templateList: [],
|
||||
page: 1
|
||||
}
|
||||
},
|
||||
|
||||
@@ -134,16 +160,26 @@
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getTemplateList()
|
||||
this.$nextTick(() => {
|
||||
this.height = document.querySelector('.ai-list__content--right').clientHeight - 140
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
getTemplateList () {
|
||||
this.$http.post('/api/template/getPage?size=-1').then(res => {
|
||||
if (res.code === 0) {
|
||||
this.templateList = res.data.records
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
toPrint(row) {
|
||||
this.isLoading = true
|
||||
this.$http.post(`/api/template/detail?id=${row.templateId}`).then(res => {
|
||||
this.isLoading = false
|
||||
if (res.code === 0) {
|
||||
const params = JSON.parse(res.data.params)
|
||||
const getValue = v => params.filter(e => e.fieldValue === v)[0].fieldName
|
||||
Object.keys(row).forEach(key => {
|
||||
@@ -151,9 +187,20 @@
|
||||
row[getValue(key)] = row[key]
|
||||
}
|
||||
})
|
||||
this.printData = {
|
||||
template: JSON.parse(res.data.content),
|
||||
data: row
|
||||
}
|
||||
this.isShow = true
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
if (res.code === 0) {
|
||||
this.$refs.printRef.toPrint(JSON.parse(res.data.content), row)
|
||||
onConfirm () {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.isShow = false
|
||||
this.$refs.printRef.toPrint(this.printData.template, new Array(this.form.count).fill(this.printData.data))
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -178,8 +225,94 @@
|
||||
})
|
||||
},
|
||||
|
||||
handleSelectionChange(e) {
|
||||
this.skuChoosedList = e
|
||||
getDeliveryOrderSn (page) {
|
||||
return new Promise(resolve => {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bgSongbird-api/supplier/deliverGoods/management/pageQueryDeliveryBatch',
|
||||
needMallId: true,
|
||||
mallId: this.search.mallId,
|
||||
anti: true,
|
||||
data: {
|
||||
pageNo: page,
|
||||
status: 1,
|
||||
onlyTaxWarehouseWaitApply: false,
|
||||
productLabelCodeStyle: 0,
|
||||
pageSize: 200
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.errorCode == 1000000) {
|
||||
resolve({
|
||||
list: res.result.list.map(v => v.deliveryOrderSn),
|
||||
isHasNext: res.result.total && res.result.list.length && (res.result.list.length < 200)
|
||||
})
|
||||
} else {
|
||||
resolve({ list: [], isHasNext: false })
|
||||
}
|
||||
}).catch(() => {
|
||||
resolve({ list: [], isHasNext: false })
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
getLabels (deliveryOrderSnList) {
|
||||
return new Promise(resolve => {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bgSongbird-api/supplier/deliverGoods/management/printProductSkuLabel',
|
||||
needMallId: true,
|
||||
mallId: this.search.mallId,
|
||||
anti: true,
|
||||
data: {
|
||||
deliveryOrderSnList: deliveryOrderSnList
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.errorCode == 1000000) {
|
||||
resolve(res.data.result.map(v => {
|
||||
return {
|
||||
productName: v.productName,
|
||||
productSkcId: v.productSkcId,
|
||||
productSkuId: v.productSkuId,
|
||||
labelCode: v.labelCode,
|
||||
skuExtCode: v.skuExtCode,
|
||||
deliveryNum: v.deliveryNum,
|
||||
skuSpecName: v.secondarySpecVOList.map(item => {
|
||||
return item.specName
|
||||
}).join(',')
|
||||
}
|
||||
}))
|
||||
} else {
|
||||
resolve([])
|
||||
}
|
||||
}).catch(() => {
|
||||
resolve([])
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
async searchSkuList () {
|
||||
let page = 1
|
||||
let isHasNext = true
|
||||
let list = []
|
||||
let deliveryOrderSnList = []
|
||||
this.isLoading = true
|
||||
while (isHasNext) {
|
||||
const result = await this.getDeliveryOrderSn(page)
|
||||
page = page + 1
|
||||
isHasNext = result.isHasNext ? true : false
|
||||
deliveryOrderSnList.push(...result.list)
|
||||
|
||||
await this.$sleepSync(1000)
|
||||
}
|
||||
|
||||
const len = Math.ceil(deliveryOrderSnList.length / 100)
|
||||
for (let i = 0; i < len; i++) {
|
||||
this.page = 1
|
||||
const ids = [...new Set(deliveryOrderSnList)].slice(i * 100, i * 100 + 100).join(',')
|
||||
const res = await this.getLabels(ids)
|
||||
list.push(...res)
|
||||
await this.$sleepSync(500)
|
||||
}
|
||||
|
||||
console.log(list)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
:auto-upload="false"
|
||||
:file-list="fileList"
|
||||
:on-change="onExcelChange">
|
||||
<el-button size="small" type="danger">Excel导入</el-button>
|
||||
<el-button size="small" type="danger" :disabled="!skuList.length">Excel导入</el-button>
|
||||
</el-upload>
|
||||
<json-excel
|
||||
:data="skuList"
|
||||
@@ -29,19 +29,44 @@
|
||||
<el-button size="small" type="warning" :disabled="!skuList.length">Excel导出</el-button>
|
||||
</json-excel>
|
||||
</template>
|
||||
<template #right>
|
||||
</ai-search-bar>
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<div class="search-item" style="margin-bottom: 0;">
|
||||
<label>SKU:</label>
|
||||
<el-input
|
||||
v-model="search.productSkuId"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入SKU"
|
||||
suffix-icon="iconfont iconSearch"
|
||||
@clear="getList">
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="search-item" style="margin-bottom: 0;">
|
||||
<label>SKC:</label>
|
||||
<el-input
|
||||
v-model="search.productSkcId"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
placeholder="请输入SKC"
|
||||
clearable
|
||||
suffix-icon="iconfont iconSearch"
|
||||
@clear="getList">
|
||||
</el-input>
|
||||
</div>
|
||||
<el-button style="margin-left: 10px;" @click="getList" size="small" :loading="pageShow">查询</el-button>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
:tableData="skuList"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
style="margin-top: 8px;"
|
||||
@getList="getList"
|
||||
@selection-change="handleSelectionChange"
|
||||
v-loading="pageShow">
|
||||
v-loading="pageShow"
|
||||
:isShowPagination="false">
|
||||
<el-table-column
|
||||
v-for="(item, index) in relationList"
|
||||
:key="index"
|
||||
@@ -50,19 +75,19 @@
|
||||
:label="item.name"
|
||||
align="center">
|
||||
</el-table-column>
|
||||
<!-- <el-table-column slot="options" label="操作" align="center" fixed="right" width="240px">
|
||||
<el-table-column slot="options" label="操作" align="center" fixed="right" width="120px">
|
||||
<template v-slot="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button type="text" @click="toAdd(row.url)">编辑</el-button>
|
||||
<el-button type="text" @click="toDetail(row.url)">删除</el-button>
|
||||
<el-button type="text" @click="remove(row.id)">删除</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
<ai-dialog
|
||||
:visible.sync="isShow"
|
||||
title="添加SKU"
|
||||
width="1400px"
|
||||
customFooter
|
||||
@confirm="onConfirm">
|
||||
<div class="search-item__wrapper">
|
||||
<div class="left">
|
||||
@@ -155,6 +180,10 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
<template #footer>
|
||||
<el-button @click="isShow = false">取消</el-button>
|
||||
<el-button @click="onConfirm" type="primary" :loading="btnLoading">确认</el-button>
|
||||
</template>
|
||||
</ai-dialog>
|
||||
</template>
|
||||
</ai-list>
|
||||
@@ -176,7 +205,9 @@
|
||||
total: 0,
|
||||
search: {
|
||||
current: 1,
|
||||
size: 100
|
||||
size: -1,
|
||||
productSkuId: '',
|
||||
productSkcId: ''
|
||||
},
|
||||
lableSearch: {
|
||||
current: 1,
|
||||
@@ -225,7 +256,8 @@
|
||||
id: '',
|
||||
fileList: [],
|
||||
pageShow: false,
|
||||
relationList: []
|
||||
relationList: [],
|
||||
btnLoading: false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -239,7 +271,7 @@
|
||||
},
|
||||
|
||||
colConfigs () {
|
||||
const arr = this.isShow ? [] : this.relationList.map(v => {
|
||||
const fields = this.isShow ? [] : this.relationList.map(v => {
|
||||
return {
|
||||
prop: v.field,
|
||||
label: v.name,
|
||||
@@ -256,7 +288,7 @@
|
||||
{ prop: 'productSkuId', label: 'SKU', align: 'center' },
|
||||
{ prop: 'skuExtCode', label: 'SKU货号', align: 'center' },
|
||||
{ prop: 'skuSpecName', label: '次销售属性', align: 'center' },
|
||||
...arr
|
||||
...fields
|
||||
]
|
||||
},
|
||||
|
||||
@@ -287,8 +319,6 @@
|
||||
this.$http.post(`/api/templateRelation/getRelation?templateId=${this.$route.query.id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.relationList = res.data
|
||||
|
||||
console.log(this.relationList)
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -313,7 +343,6 @@
|
||||
onExcelChange (file) {
|
||||
this.pageShow = true
|
||||
this.readXLSX(file.raw).then(res => {
|
||||
console.log(res)
|
||||
this.$http.post(`/api/templateSku/updateBatchSku`, res.map(v => {
|
||||
const result = {
|
||||
templateId: this.id
|
||||
@@ -322,7 +351,6 @@
|
||||
result[this.jsonFields[item]] = v[item]
|
||||
})
|
||||
|
||||
console.log(result)
|
||||
return result
|
||||
})).then(res => {
|
||||
if (res.code === 0) {
|
||||
@@ -341,7 +369,6 @@
|
||||
},
|
||||
|
||||
handleSelectionChange(e) {
|
||||
console.log(e)
|
||||
this.chooseSkuList = e
|
||||
},
|
||||
|
||||
@@ -353,7 +380,7 @@
|
||||
mallId: this.lableSearch.mallId,
|
||||
anti: true,
|
||||
data: {
|
||||
page: 1,
|
||||
page: page,
|
||||
pageSize: 200,
|
||||
catIds: catIds
|
||||
}
|
||||
@@ -361,7 +388,7 @@
|
||||
if (res.errorCode == 1000000) {
|
||||
resolve({
|
||||
list: res.result.pageItems.map(v => v.productSkcId),
|
||||
isHasNext: page * 200 < res.result.total
|
||||
isHasNext: res.result.pageItems.length < 200
|
||||
})
|
||||
} else {
|
||||
resolve({ list: [], isHasNext: false })
|
||||
@@ -373,7 +400,6 @@
|
||||
},
|
||||
|
||||
async onCateChange() {
|
||||
this.$userCheck(this.lableSearch.mallId).then(async () => {
|
||||
let page = 1
|
||||
let list = []
|
||||
let isHasNext = true
|
||||
@@ -385,7 +411,7 @@
|
||||
isHasNext = result.isHasNext ? true : false
|
||||
list.push(...result.list)
|
||||
|
||||
await this.$sleepSync(5000)
|
||||
await this.$sleepSync(1000)
|
||||
}
|
||||
|
||||
const skcList = [...new Set(list)]
|
||||
@@ -394,14 +420,8 @@
|
||||
this.skuReqParams.page = 1
|
||||
this.skuReqParams.SKC = [...new Set(list)].slice(i * 100, i * 100 + 100).join(',')
|
||||
await this.requestSKUList(true)
|
||||
await this.$sleepSync(2000)
|
||||
await this.$sleepSync(500)
|
||||
}
|
||||
|
||||
console.log(111)
|
||||
this.isLoading = false
|
||||
}).catch(() => {
|
||||
this.lableSearch.mallId = ''
|
||||
})
|
||||
},
|
||||
|
||||
requestSKUList(flag) {
|
||||
@@ -437,7 +457,7 @@
|
||||
|
||||
if (res.result.total > this.lableList.length) {
|
||||
this.skuReqParams.page++
|
||||
await this.$sleepSync(5000)
|
||||
await this.$sleepSync(500)
|
||||
await this.requestSKUList()
|
||||
} else {
|
||||
!flag && (this.isLoading = false)
|
||||
@@ -451,22 +471,25 @@
|
||||
return this.$message.error('请选择店铺')
|
||||
}
|
||||
|
||||
this.$userCheck(this.lableSearch.mallId).then(() => {
|
||||
this.lableList = []
|
||||
this.skuReqParams.page = 1
|
||||
this.isLoading = true
|
||||
this.requestSKUList()
|
||||
}).catch(() => {
|
||||
this.lableSearch.mallId = ''
|
||||
})
|
||||
},
|
||||
|
||||
getList () {
|
||||
this.$http.post(`/api/templateSku/getPage?size=-1&templateId=${this.id}`).then(res => {
|
||||
this.pageShow = true
|
||||
this.$http.post(`/api/templateSku/getPage`, null, {
|
||||
params: {
|
||||
...this.search,
|
||||
templateId: this.id
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.skuList = res.data.records
|
||||
// this.total = res.data.total
|
||||
}
|
||||
|
||||
this.pageShow = false
|
||||
})
|
||||
},
|
||||
|
||||
@@ -475,6 +498,7 @@
|
||||
return this.$message.error('请选择SKU')
|
||||
}
|
||||
|
||||
this.btnLoading = true
|
||||
this.$http.post(`/api/templateSku/addBatchSku`, this.chooseSkuList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
@@ -486,8 +510,24 @@
|
||||
this.isShow = false
|
||||
this.getList()
|
||||
}
|
||||
|
||||
this.btnLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
remove (id) {
|
||||
this.$confirm('确定删除该数据?', '温馨提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http.post(`/api/templateSku/removeById?id=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功')
|
||||
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -8,10 +8,42 @@
|
||||
<template slot="content">
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<div class="search-item">
|
||||
<label>SKU:</label>
|
||||
<el-input
|
||||
v-model="search.productSkuId"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="请输入SKU"
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label>SKC:</label>
|
||||
<el-input
|
||||
v-model="search.productSkcId"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
placeholder="请输入SKC"
|
||||
clearable
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label>模板名称:</label>
|
||||
<el-input
|
||||
v-model="search.name"
|
||||
style="width: 250px"
|
||||
size="small"
|
||||
placeholder="请输入模板名称"
|
||||
clearable
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
</div>
|
||||
<el-button style="margin-left: 10px;" @click="getList" size="small" :loading="isLoading">查询</el-button>
|
||||
<el-button type="primary" size="small" @click="toAdd('')">添加</el-button>
|
||||
</template>
|
||||
<template #right>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
@@ -20,13 +52,14 @@
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
style="margin-top: 8px;"
|
||||
@getList="getList">
|
||||
@getList="getList"
|
||||
:loading="isLoading">
|
||||
<el-table-column slot="options" label="操作" align="center" fixed="right" width="220px">
|
||||
<template v-slot="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button type="text" @click="toAddSku(row.id)">添加SKU</el-button>
|
||||
<el-button type="text" @click="toAddSku(row.id)">管理SKU</el-button>
|
||||
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
|
||||
<el-button type="text" @click="toDetail(row.url)">删除</el-button>
|
||||
<el-button type="text" @click="remove(row.id)">删除</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -46,11 +79,15 @@
|
||||
{ prop: 'count', label: '绑定SKU数量', align: 'center' },
|
||||
{ prop: 'createTime', label: '创建时间', align: 'center' },
|
||||
],
|
||||
isLoading: false,
|
||||
tableData: [],
|
||||
total: 0,
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10
|
||||
size: 10,
|
||||
name: '',
|
||||
productSkuId: '',
|
||||
productSkcId: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -69,6 +106,7 @@
|
||||
},
|
||||
|
||||
getList () {
|
||||
this.isLoading = true
|
||||
this.$http.post('/api/template/getPage', null, {
|
||||
params: {
|
||||
...this.search
|
||||
@@ -78,6 +116,22 @@
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
remove (id) {
|
||||
this.$confirm('确定删除该模板?', '温馨提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http.post(`/api/template/removeById?id=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功')
|
||||
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
@@ -89,4 +143,9 @@
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.Template {
|
||||
.search-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user