【新增】晚上打印页面和标签组件
This commit is contained in:
@@ -373,10 +373,11 @@ table.hiprint-printElement-tableTarget {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
width: 93%;
|
width: 94%;
|
||||||
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.temuBarCode-middle {
|
.temuBarCode-middle {
|
||||||
width: 85%;
|
width: 88%;
|
||||||
height: 60%;
|
height: 60%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,11 +34,12 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
width: 93%;
|
width: 94%;
|
||||||
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.temuBarCode-middle {
|
.temuBarCode-middle {
|
||||||
width: 85%;
|
width: 88%;
|
||||||
height: 60%;
|
height: 60%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
<h2>{{ title }}</h2>
|
<h2>{{ title }}</h2>
|
||||||
<p>{{ tips }}</p>
|
<p>{{ tips }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ailist-title__middle">
|
||||||
|
<slot name="center"/>
|
||||||
|
</div>
|
||||||
<div class="ailist-title__right">
|
<div class="ailist-title__right">
|
||||||
<div class="aititle-right__btns">
|
<div class="aititle-right__btns">
|
||||||
<slot name="rightBtn"/>
|
<slot name="rightBtn"/>
|
||||||
@@ -75,6 +78,11 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
|
|
||||||
|
.ailist-title__middle {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.ailist-title__left {
|
.ailist-title__left {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -262,7 +262,6 @@
|
|||||||
addItemToCanvas(name) {
|
addItemToCanvas(name) {
|
||||||
this.panel.addPrintText({
|
this.panel.addPrintText({
|
||||||
options: {
|
options: {
|
||||||
left: 200,
|
|
||||||
field: name,
|
field: name,
|
||||||
testData: name,
|
testData: name,
|
||||||
title: '',
|
title: '',
|
||||||
|
|||||||
@@ -9,19 +9,28 @@ export const customProvider = function (options) {
|
|||||||
title: 'temu条码',
|
title: 'temu条码',
|
||||||
data: 'XS888888888',
|
data: 'XS888888888',
|
||||||
type: 'html',
|
type: 'html',
|
||||||
formatter: function (data, options, templateData) {
|
formatter: function (data, options, sukData) {
|
||||||
console.log(data, options, templateData)
|
|
||||||
const elId = options.elId || 'barCode-' + new Date().getTime()
|
const elId = options.elId || 'barCode-' + new Date().getTime()
|
||||||
const codeWidth = parseInt((options.width - 22) * 0.85)
|
const codeWidth = parseInt((options.width - 22) * 0.85)
|
||||||
|
let printData = {
|
||||||
|
labelCode: 96778555251,
|
||||||
|
productSkuId: 6606980005,
|
||||||
|
skuExtCode: 'AAA1100mWh-orange',
|
||||||
|
skuSpecName: '8pcs'
|
||||||
|
}
|
||||||
|
|
||||||
options.elId = `${elId}`
|
options.elId = `${elId}`
|
||||||
|
if (sukData) {
|
||||||
|
printData = sukData
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
$('body').append(`<div id="codewrapper-${elId}" style="width: ${codeWidth}pt">
|
$('body').append(`<div id="codewrapper-${elId}" style="width: ${codeWidth}pt">
|
||||||
<svg id="${elId}" width="100%" display="block" height="100%" class="hibarcode_imgcode" preserveAspectRatio="none slice"></svg>
|
<svg id="${elId}" width="100%" display="block" height="100%" class="hibarcode_imgcode" preserveAspectRatio="none slice"></svg>
|
||||||
</div>`)
|
</div>`)
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
JsBarcode('#'+ elId, '96778555251', {
|
JsBarcode('#' + elId, printData.labelCode, {
|
||||||
format: "CODE128B",
|
format: 'CODE128B',
|
||||||
width: 2,
|
width: 2,
|
||||||
height: parseInt(hinnn.pt.toPx(options.height - 22).toString()) * 0.6,
|
height: parseInt(hinnn.pt.toPx(options.height - 22).toString()) * 0.6,
|
||||||
margin: 0,
|
margin: 0,
|
||||||
@@ -34,7 +43,7 @@ export const customProvider = function (options) {
|
|||||||
$(`body>#codewrapper-${elId}`).remove()
|
$(`body>#codewrapper-${elId}`).remove()
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const resizeObserver = new ResizeObserver(() => {
|
const resizeObserver = new ResizeObserver(() => {
|
||||||
JsBarcode('#'+ elId, '96778555251', {
|
JsBarcode('#'+ elId, printData.labelCode, {
|
||||||
format: "CODE128B",
|
format: "CODE128B",
|
||||||
width: 2,
|
width: 2,
|
||||||
height: parseInt(hinnn.pt.toPx(options.height - 22).toString()) * 0.6,
|
height: parseInt(hinnn.pt.toPx(options.height - 22).toString()) * 0.6,
|
||||||
@@ -52,8 +61,8 @@ export const customProvider = function (options) {
|
|||||||
var html = `
|
var html = `
|
||||||
<div class="temuBarCode" id="temuBarCode-${elId}">
|
<div class="temuBarCode" id="temuBarCode-${elId}">
|
||||||
<div class="temuBarCode-top">
|
<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">${ printData.skuExtCode }</div>
|
||||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">AA 20PCS+AAA 20PCS</div>
|
<div class="hiprint-printElement-text-content hiprint-printElement-content">${ printData.skuSpecName }</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="temuBarCode-middle">
|
<div class="temuBarCode-middle">
|
||||||
<div class="hiprint-printElement-text-content hiprint-printElement-content temuBarCode-code" style="width: 100%">
|
<div class="hiprint-printElement-text-content hiprint-printElement-content temuBarCode-code" style="width: 100%">
|
||||||
@@ -61,7 +70,7 @@ export const customProvider = function (options) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="temuBarCode-bottom">
|
<div class="temuBarCode-bottom">
|
||||||
<div class="hiprint-printElement-text-content hiprint-printElement-content">1034130097</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 class="hiprint-printElement-text-content hiprint-printElement-content">Made in China</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -2,9 +2,11 @@
|
|||||||
<AiDetail class="add-label">
|
<AiDetail class="add-label">
|
||||||
<template #title>
|
<template #title>
|
||||||
<ai-title title="添加模板" isShowBack :isShowBottomBorder="true" @onBackClick="cancel">
|
<ai-title title="添加模板" isShowBack :isShowBottomBorder="true" @onBackClick="cancel">
|
||||||
<template #rightBtn>
|
<template #center>
|
||||||
<label>模板名称:</label>
|
<label>模板名称:</label>
|
||||||
<el-input placeholder="请输入模板名称" size="small" v-model="name" style="width: 200px; margin-right: 300px;"></el-input>
|
<el-input placeholder="请输入模板名称" size="small" v-model="name" style="width: 200px;"></el-input>
|
||||||
|
</template>
|
||||||
|
<template #rightBtn>
|
||||||
<el-button @click="preview" size="small" type="danger">预览</el-button>
|
<el-button @click="preview" size="small" type="danger">预览</el-button>
|
||||||
<el-button @click="savePdf" size="small" type="primary">下载pdf</el-button>
|
<el-button @click="savePdf" size="small" type="primary">下载pdf</el-button>
|
||||||
<el-button @click="print" size="small">打印</el-button>
|
<el-button @click="print" size="small">打印</el-button>
|
||||||
@@ -17,7 +19,7 @@
|
|||||||
<ai-card title="标签模板" class="card" :hideTitle="true">
|
<ai-card title="标签模板" class="card" :hideTitle="true">
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="add-label__wrapper">
|
<div class="add-label__wrapper">
|
||||||
<Print ref="printRef" :template="template" :isPrint="false"></Print>
|
<Print ref="printRef" :template="template" :printData="printData" :isPrint="false"></Print>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</ai-card>
|
</ai-card>
|
||||||
@@ -37,7 +39,17 @@
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
name: '',
|
name: '',
|
||||||
template: template
|
template: template,
|
||||||
|
printData: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.printData = {
|
||||||
|
labelCode: 96778555251,
|
||||||
|
productSkuId: 6606980005,
|
||||||
|
skuExtCode: 'AAA1100mWh-orange',
|
||||||
|
skuSpecName: '8pcs'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -67,7 +79,7 @@
|
|||||||
console.log(json)
|
console.log(json)
|
||||||
},
|
},
|
||||||
|
|
||||||
print () {
|
print() {
|
||||||
this.$refs.printRef.print()
|
this.$refs.printRef.print()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<ai-list class="Learning">
|
<ai-list class="Print-page">
|
||||||
<ai-title
|
<ai-title
|
||||||
slot="title"
|
slot="title"
|
||||||
title="标签打印"
|
title="标签打印"
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<div class="left">
|
<div class="left">
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<label>添加方式:</label>
|
<label>添加方式:</label>
|
||||||
<el-radio-group v-model="type" size="small" @change="onSearchRest">
|
<el-radio-group v-model="addType" size="small">
|
||||||
<el-radio-button label="1">按备货单打印</el-radio-button>
|
<el-radio-button label="1">按备货单打印</el-radio-button>
|
||||||
<el-radio-button label="2">按SKC打印</el-radio-button>
|
<el-radio-button label="2">按SKC打印</el-radio-button>
|
||||||
<el-radio-button label="3">按SKU打印</el-radio-button>
|
<el-radio-button label="3">按SKU打印</el-radio-button>
|
||||||
@@ -34,47 +34,47 @@
|
|||||||
<div class="left">
|
<div class="left">
|
||||||
<div class="search-item" v-show="addType === '1'">
|
<div class="search-item" v-show="addType === '1'">
|
||||||
<label>备货单:</label>
|
<label>备货单:</label>
|
||||||
<el-button style="margin-left: 10px;" @click="onCateChange" size="small" :disabled="!search.mallId" :loading="isLoading">查询</el-button>
|
<el-button style="margin-left: 10px;" size="small" :disabled="!search.mallId" :loading="isLoading">查询</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-item" v-show="addType === '2'">
|
<div class="search-item" v-show="addType === '2'">
|
||||||
<label>SKC:</label>
|
<label>SKC:</label>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="search.SKC"
|
v-model="search.SKC"
|
||||||
style="width: 250px"
|
style="width: 250px"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="多个查询请用户逗号分割"
|
placeholder="多个查询请用户逗号分割"
|
||||||
clearable
|
clearable
|
||||||
suffix-icon="iconfont iconSearch">
|
suffix-icon="iconfont iconSearch">
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-button style="margin-left: 10px;" @click="getSkuList" size="small" :disabled="!search.mallId" :loading="isLoading">查询</el-button>
|
<el-button style="margin-left: 10px;" @click="getSkuList" size="small" :disabled="!search.mallId" :loading="isLoading">查询</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-item" v-show="addType === '3'">
|
<div class="search-item" v-show="addType === '3'">
|
||||||
<label>SKU:</label>
|
<label>SKU:</label>
|
||||||
<el-input
|
<el-input
|
||||||
v-if="addType === '3'"
|
v-if="addType === '3'"
|
||||||
v-model="search.SKU"
|
v-model="search.SKU"
|
||||||
style="width: 250px"
|
style="width: 250px"
|
||||||
size="small"
|
size="small"
|
||||||
clearable
|
clearable
|
||||||
placeholder="多个查询请用户逗号分割"
|
placeholder="多个查询请用户逗号分割"
|
||||||
suffix-icon="iconfont iconSearch">
|
suffix-icon="iconfont iconSearch">
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-button style="margin-left: 10px;" @click="getSkuList" size="small" :disabled="!search.mallId" :loading="isLoading">查询</el-button>
|
<el-button style="margin-left: 10px;" @click="getSkuList" size="small" :disabled="!search.mallId" :loading="isLoading">查询</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
<el-button style="margin-bottom: 10px" type="primary" size="small" :disabled="!skuChoosedList.length" @click="printAll">批量打印</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ai-table
|
<ai-table
|
||||||
:tableData="tableData"
|
:tableData="lableList"
|
||||||
:col-configs="colConfigs"
|
:col-configs="colConfigs"
|
||||||
:total="total"
|
|
||||||
:current.sync="search.current"
|
|
||||||
:size.sync="search.size"
|
|
||||||
:isShowPagination="false"
|
:isShowPagination="false"
|
||||||
@getList="getList">
|
:height="height"
|
||||||
|
@getList="() => {}"
|
||||||
|
@selection-change="handleSelectionChange">
|
||||||
<el-table-column slot="options" label="操作" align="center" fixed="right" width="140px">
|
<el-table-column slot="options" label="操作" align="center" fixed="right" width="140px">
|
||||||
<template v-slot="{ row }">
|
<template v-slot="{ row }">
|
||||||
<div class="table-options">
|
<div class="table-options">
|
||||||
<el-button type="text">打印</el-button>
|
<el-button type="text" @click="toPrint(row)">打印</el-button>
|
||||||
<el-button type="text" @click="toDetail(row.url)">详情</el-button>
|
<el-button type="text" @click="toDetail(row.url)">详情</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -87,6 +87,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Print from '@/components/print/Print'
|
import Print from '@/components/print/Print'
|
||||||
|
import template from '@/components/print/template'
|
||||||
|
import { sendChromeAPIMessage } from '@/api/chromeApi'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PrintPage',
|
name: 'PrintPage',
|
||||||
@@ -98,35 +100,127 @@
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
colConfigs: [
|
colConfigs: [
|
||||||
{ prop: 'title', label: '标题', align: 'left' },
|
{ type: 'selection' },
|
||||||
{ prop: 'createTime', label: '发布时间', align: 'center' },
|
{ prop: 'mallName', label: '店铺名称', align: 'left' },
|
||||||
|
{ prop: 'labelCode', label: '条码编码', align: 'center' },
|
||||||
|
{ prop: 'productSkuId', label: 'SKU', align: 'center' },
|
||||||
|
{ prop: 'skuExtCode', label: 'SKU货号', align: 'center' },
|
||||||
|
{ prop: 'skuSpecName', label: '次销售属性', align: 'center' }
|
||||||
],
|
],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
search: {
|
search: {
|
||||||
mallId: '',
|
mallId: '',
|
||||||
SKC: '',
|
SKC: '',
|
||||||
SKU: ''
|
SKU: '',
|
||||||
|
page: 1
|
||||||
},
|
},
|
||||||
cateList: [],
|
addType: '1',
|
||||||
type: '1',
|
isLoading: false,
|
||||||
isLoading: false
|
lableList: [],
|
||||||
|
height: 600,
|
||||||
|
skuChoosedList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
created () {
|
computed: {
|
||||||
this.getList()
|
currMall () {
|
||||||
|
if (!this.$store.state.mallList.length) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.$store.state.mallList.filter(v => v.mallId === this.search.mallId)[0]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.height = document.querySelector('.ai-list__content--right').clientHeight - 140
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
toPrint (template, printData) {
|
toPrint(row) {
|
||||||
this.$refs.printData.print(template, printData)
|
this.$refs.printRef.toPrint(template, row)
|
||||||
},
|
},
|
||||||
|
|
||||||
getList () {
|
requestSKUList() {
|
||||||
|
return sendChromeAPIMessage({
|
||||||
|
url: 'bg-visage-mms/labelcode/pageQuery',
|
||||||
|
needMallId: true,
|
||||||
|
mallId: this.search.mallId,
|
||||||
|
anti: true,
|
||||||
|
data: {
|
||||||
|
page: this.search.page,
|
||||||
|
pageSize: 200,
|
||||||
|
productSkcIdList: this.search.SKC.split(','),
|
||||||
|
productSkuIdList: this.addType === '3' ? this.search.SKU.split(',') : []
|
||||||
|
}
|
||||||
|
}).then(async (res) => {
|
||||||
|
if (res.errorCode == 1000000) {
|
||||||
|
const list = res.result.pageItems.map(v => {
|
||||||
|
return {
|
||||||
|
mallId: this.search.mallId,
|
||||||
|
mallName: this.currMall.mallName,
|
||||||
|
productName: v.productName,
|
||||||
|
productSkuId: v.labelCodeVO.productSkuId,
|
||||||
|
labelCode: v.labelCodeVO.labelCode,
|
||||||
|
skuExtCode: v.labelCodeVO.skuExtCode,
|
||||||
|
skuSpecName: v.productSkuSpecList.map(item => {
|
||||||
|
return item.specName
|
||||||
|
}).join(',')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.lableList.push(...list)
|
||||||
|
|
||||||
|
if (res.result.total > this.lableList.length) {
|
||||||
|
this.search.page++
|
||||||
|
await this.$sleepSync(5000)
|
||||||
|
await this.requestSKUList()
|
||||||
|
} else {
|
||||||
|
this.isLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
printAll() {
|
||||||
|
this.$refs.printRef.toPrint(template, this.skuChoosedList)
|
||||||
|
},
|
||||||
|
|
||||||
|
getSkuList () {
|
||||||
|
if (!this.search.mallId) {
|
||||||
|
return this.$message.error('请选择店铺')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$userCheck(this.search.mallId).then(() => {
|
||||||
|
this.lableList = []
|
||||||
|
this.search.page = 1
|
||||||
|
this.isLoading = true
|
||||||
|
this.requestSKUList()
|
||||||
|
}).catch(() => {
|
||||||
|
this.search.mallId = ''
|
||||||
|
this.isLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSelectionChange(e) {
|
||||||
|
this.skuChoosedList = e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.Print-page {
|
||||||
|
.search-item__wrapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
&>div {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'Template',
|
name: 'PringTemplate',
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user