diff --git a/src/components/print/Print.vue b/src/components/print/Print.vue
index 334cee9..9be8580 100644
--- a/src/components/print/Print.vue
+++ b/src/components/print/Print.vue
@@ -95,6 +95,7 @@
自定义纸张
+ 模板库
@@ -180,6 +181,28 @@
+
+
+
+
+
+ 使用
+
+
+
+
+
+
@@ -249,6 +272,8 @@
html: '',
isShowPreview: false,
hiprintTemplate: null,
+ isShowTemplate: false,
+ templateList: [],
curPaper: {
type: 'other',
width: 200,
@@ -279,9 +304,18 @@
size: 10,
type: 1
},
+ searchTemplate: {
+ current: 1,
+ size: 10,
+ type: 1
+ },
+ templateTotal: 0,
isShowImage: false,
tableData: [],
- total: 0
+ total: 0,
+ templateColConfigs: [
+ { prop: 'name', label: '模板名称', align: 'center' }
+ ]
}
},
@@ -342,6 +376,8 @@
this.buildLeftElement()
this.buildDesigner()
this.getConfig()
+
+ this.getTemplateList()
}
},
@@ -355,14 +391,28 @@
}
this.isShowDynamicForm = true
-
- console.log(this.dynamicFrom)
},
removeField(index) {
this.dynamicFromList.splice(index, 1)
},
+ updateTempate(row) {
+
+ this.hiprintTemplate.update(JSON.parse(row.content))
+ },
+
+ getTemplateList() {
+ this.$http.post(`/api/templateRecommend/getRecommendPage`, null, {
+ params: this.searchTemplate
+ }).then(res => {
+ if (res.code === 0) {
+ this.templateList = res.data.records
+ this.templateTotal = res.data.total
+ }
+ })
+ },
+
getConfig() {
this.$http.post(`/api/material/getPage?current=${this.search.current}&size=${this.search.size}&type=${this.search.type}`).then(res => {
if (res.code === 0) {
diff --git a/src/view/Home.vue b/src/view/Home.vue
index adc1ebf..6f14ded 100644
--- a/src/view/Home.vue
+++ b/src/view/Home.vue
@@ -192,16 +192,23 @@
数据统计
-->
-
+
- 标签管理
- 开通
+ 高级功能
- 模板管理
- 标签打印
+
+
+
+ 标签管理
+ 开通
+
+
+ 模板管理
+ 标签打印
+
diff --git a/src/view/lables/Print.vue b/src/view/lables/Print.vue
index 6283a4a..54fab75 100644
--- a/src/view/lables/Print.vue
+++ b/src/view/lables/Print.vue
@@ -78,11 +78,10 @@
:height="height"
@getList="() => {}"
:loading="isLoading">
-
+
打印
- 详情
@@ -93,7 +92,7 @@
title="打印数量"
width="890px"
@confirm="onConfirm">
-
+
@@ -118,13 +117,13 @@
data () {
return {
colConfigs: [
- { type: 'selection' },
{ prop: 'mallName', label: '店铺名称', align: 'left' },
{ prop: 'labelCode', label: '条码编码', align: 'center' },
{ prop: 'productSkcId', label: 'SKC', align: 'center' },
{ prop: 'productSkuId', label: 'SKU', align: 'center' },
{ prop: 'skuExtCode', label: 'SKU货号', align: 'center' },
- { prop: 'skuSpecName', label: '次销售属性', align: 'center' }
+ { prop: 'skuSpecName', label: '次销售属性', align: 'center' },
+ { prop: 'deliveryNum', label: '发货数', align: 'center' }
],
search: {
mallId: '',
@@ -177,23 +176,52 @@
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 => {
- if (params.findIndex(v => v.fieldValue === key) > -1) {
- row[getValue(key)] = row[key]
+ if (this.addType === '1') {
+ this.$http.post(`/api/template/getPage?productSkuId=${row.productSkuId}`).then(res => {
+ if (!res.data.records.length) {
+ this.isLoading = false
+ return this.$message.error('该SKU未配置模板')
+ }
+
+ this.$http.post(`/api/template/detail?id=${res.data.records[0].id}`).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 => {
+ if (params.findIndex(v => v.fieldValue === key) > -1) {
+ row[getValue(key)] = row[key]
+ }
+ })
+
+ this.$refs.printRef.toPrint(JSON.parse(res.data.content), new Array(row.deliveryNum).fill(row))
}
})
- this.printData = {
- template: JSON.parse(res.data.content),
- data: row
+ })
+ } else {
+ this.$http.post(`/api/template/detail?id=${row.templateId}`).then(res => {
+ this.isLoading = false
+ if (res.code === 0) {
+ if (!res.data) {
+ this.isLoading = false
+ return this.$message.error('该SKU未配置模板')
+ }
+ const params = JSON.parse(res.data.params)
+ const getValue = v => params.filter(e => e.fieldValue === v)[0].fieldName
+ Object.keys(row).forEach(key => {
+ if (params.findIndex(v => v.fieldValue === key) > -1) {
+ row[getValue(key)] = row[key]
+ }
+ })
+
+ this.printData = {
+ template: JSON.parse(res.data.content),
+ data: row
+ }
+ this.isShow = true
}
- this.isShow = true
- }
- })
+ })
+ }
},
onConfirm () {
@@ -242,8 +270,8 @@
}).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)
+ list: [].concat(res.result.list.map(v => v.deliveryOrderList.map(e => e.deliveryOrderSn)).flat()),
+ isHasNext: res.result.total && res.result.list.length && (res.result.list.length < 200 && res.result.total > 200)
})
} else {
resolve({ list: [], isHasNext: false })
@@ -266,8 +294,9 @@
}
}).then(res => {
if (res.errorCode == 1000000) {
- resolve(res.data.result.map(v => {
+ resolve(res.result.map(v => {
return {
+ mallName: this.$store.state.mallList.filter(v => v.mallId === this.search.mallId)[0].mallName,
productName: v.productName,
productSkcId: v.productSkcId,
productSkuId: v.productSkuId,
@@ -306,12 +335,15 @@
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 ids = [...new Set(deliveryOrderSnList)].slice(i * 100, i * 100 + 100)
const res = await this.getLabels(ids)
list.push(...res)
await this.$sleepSync(500)
}
+ this.isLoading = false
+
+ this.lableList = list
console.log(list)
}
}
diff --git a/src/view/lables/SkuManage.vue b/src/view/lables/SkuManage.vue
index 87ca8a1..3cf8a9f 100644
--- a/src/view/lables/SkuManage.vue
+++ b/src/view/lables/SkuManage.vue
@@ -56,11 +56,18 @@
@clear="getList">
+
+
+
+
+
+
+
查询
v.field)
+ return this.skuList.filter(v => keys.some(e => !v[e]))
+ },
+
currMall () {
if (!this.$store.state.mallList.length) {
return {}
@@ -324,9 +345,8 @@
},
readXLSX(file) {
- return new Promise((resolve, reject) => {
+ return new Promise(resolve => {
const reader = new FileReader()
-
reader.readAsBinaryString(file)
reader.onload = evt => {
const data = evt.target.result
@@ -380,7 +400,7 @@
mallId: this.lableSearch.mallId,
anti: true,
data: {
- page: page,
+ page,
pageSize: 200,
catIds: catIds
}
@@ -388,7 +408,7 @@
if (res.errorCode == 1000000) {
resolve({
list: res.result.pageItems.map(v => v.productSkcId),
- isHasNext: res.result.pageItems.length < 200
+ isHasNext: res.result.total && res.result.pageItems.length && (res.result.pageItems.length < 200 && res.result.total > 200)
})
} else {
resolve({ list: [], isHasNext: false })
diff --git a/src/view/lables/Template.vue b/src/view/lables/Template.vue
index 82a7e8d..7145ca9 100644
--- a/src/view/lables/Template.vue
+++ b/src/view/lables/Template.vue
@@ -76,7 +76,7 @@
return {
colConfigs: [
{ prop: 'name', label: '模板名称', align: 'left' },
- { prop: 'count', label: '绑定SKU数量', align: 'center' },
+ { prop: 'skuTotal', label: '绑定SKU数量', align: 'center' },
{ prop: 'createTime', label: '创建时间', align: 'center' },
],
isLoading: false,