|
@@ -44,7 +44,7 @@
|
|
|
|
|
|
</div>
|
|
|
<div class="card-setting">
|
|
|
- <div class="card-left" :style="`max-height: ${params.dmPaperLength}mm;max-width: ${params.dmPaperWidth}mm;`">
|
|
|
+ <div class="card-left" :style="`max-height: ${params.cardHeight}mm;max-width: ${params.cardWidth}mm;`">
|
|
|
<i class="el-icon-arrow-down icon1" :style="`top:${params.paddingTop}mm;left:${params.paddingLeft}mm;`"></i>
|
|
|
<i class="el-icon-arrow-down icon2" :style="`top:${params.paddingTop}mm;right:${params.paddingRight}mm;`"></i>
|
|
|
<i class="el-icon-arrow-down icon3" :style="`bottom:${params.paddingBottom}mm;left:${params.paddingLeft}mm;`"></i>
|
|
@@ -57,7 +57,7 @@
|
|
|
<div class="setting-params">
|
|
|
<div class="card-title">所属门店<div class="card-tip"> (设置门店专属贺卡样式)</div>
|
|
|
</div>
|
|
|
- <el-select v-model="params.shopId" multiple @change="changeShop">
|
|
|
+ <el-select v-model="params.shopIdList" multiple @change="changeShop" clearable>
|
|
|
<el-option v-for="item in shopList" :key="item.id" :value="item.id" :label="item.name">
|
|
|
<div>{{ item.name }}</div>
|
|
|
</el-option>
|
|
@@ -73,7 +73,7 @@
|
|
|
</div>
|
|
|
<div class="setting-params">
|
|
|
<div class="card-title">打印方向</div>
|
|
|
- <el-select v-model="params.dmOrientation">
|
|
|
+ <el-select v-model="params.direction">
|
|
|
<el-option v-for="item in directonList" :key="item.value" :value="item.value" :label="item.name">
|
|
|
<div>{{ item.name }}</div>
|
|
|
</el-option>
|
|
@@ -81,7 +81,7 @@
|
|
|
</div>
|
|
|
<div class="setting-params">
|
|
|
<div class="card-title">贺卡尺寸类型</div>
|
|
|
- <el-select v-model="params.dmPaperSize" @change="changeDmPaperSize">
|
|
|
+ <el-select v-model="params.sizeType" @change="changeDmPaperSize">
|
|
|
<el-option v-for="item in paperSize" :key="item.value" :value="item.value" :label="item.name">
|
|
|
<div>{{ item.name }}</div>
|
|
|
</el-option>
|
|
@@ -89,11 +89,11 @@
|
|
|
</div>
|
|
|
<div class="setting-params">
|
|
|
<div class="card-title">贺卡尺寸</div>
|
|
|
- <el-input :disabled="[9,11].includes(params.dmPaperSize)" v-model="params.dmPaperWidth">
|
|
|
+ <el-input :disabled="[9,11].includes(params.sizeType)" v-model="params.cardWidth">
|
|
|
<template slot="prepend">宽</template>
|
|
|
<template slot="append">毫米</template>
|
|
|
</el-input>
|
|
|
- <el-input :disabled="[9,11].includes(params.dmPaperSize)" v-model="params.dmPaperLength">
|
|
|
+ <el-input :disabled="[9,11].includes(params.sizeType)" v-model="params.cardHeight">
|
|
|
<template slot="prepend">高</template>
|
|
|
<template slot="append">毫米</template>
|
|
|
</el-input>
|
|
@@ -118,7 +118,7 @@
|
|
|
</el-input>
|
|
|
</div>
|
|
|
<div class="btns">
|
|
|
- <el-button size="small" type="warning">保存贺卡</el-button>
|
|
|
+ <el-button size="small" @click="saveCard" type="warning">保存贺卡</el-button>
|
|
|
<el-button size="small" @click="printTest">打印测试页</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -170,6 +170,8 @@ import {
|
|
|
cloudPrint,
|
|
|
shopDeviceList,
|
|
|
deviceDelete,
|
|
|
+ cloudConfigList,
|
|
|
+ cloudConfigAdd,
|
|
|
} from "../../../api/shop";
|
|
|
export default {
|
|
|
name: "greetingCardPrinter",
|
|
@@ -194,17 +196,18 @@ export default {
|
|
|
shopId: 0,
|
|
|
},
|
|
|
cloudList: [],
|
|
|
+ configList: [],
|
|
|
params: {
|
|
|
- dmPaperWidth: 210,
|
|
|
- dmPaperLength: 297,
|
|
|
+ cardWidth: 210,
|
|
|
+ cardHeight: 297,
|
|
|
paddingTop: 10,
|
|
|
paddingBottom: 10,
|
|
|
paddingLeft: 10,
|
|
|
paddingRight: 10,
|
|
|
- dmOrientation: 1, // 1:竖向 2:横向
|
|
|
+ direction: 1, // 1:竖向 2:横向
|
|
|
fontFamily: "FangZhengKaiTi",
|
|
|
- shopId: [0],
|
|
|
- dmPaperSize: 9, // 纸张尺寸
|
|
|
+ shopIdList: [0],
|
|
|
+ sizeType: 9, // 纸张尺寸
|
|
|
},
|
|
|
printerList: [],
|
|
|
shopList: [],
|
|
@@ -275,8 +278,22 @@ export default {
|
|
|
watch: {},
|
|
|
// 方法集合
|
|
|
methods: {
|
|
|
+ saveCard() {
|
|
|
+ cloudConfigAdd(this.params).then((res) => {
|
|
|
+ console.log("添加贺卡配置信息", res);
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success(`保存贺卡成功!`)
|
|
|
+ this.getCloudConfigList();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "error",
|
|
|
+ message: res.msg,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
printTest() {
|
|
|
- cloudPrint().then(() => {
|
|
|
+ cloudPrint().then((res) => {
|
|
|
console.log("添加云盒信息", res);
|
|
|
if (!res.code) {
|
|
|
this.cloudList = res.data;
|
|
@@ -298,7 +315,9 @@ export default {
|
|
|
if (!this.form.deviceSecret) {
|
|
|
return this.$message.warning(`请输入云盒秘钥!`);
|
|
|
}
|
|
|
- deviceAdd(this.form).then((res) => {
|
|
|
+ let form = this.$tool.deepClone(this.form);
|
|
|
+ form.shopIds = form.shopIdList.join();
|
|
|
+ deviceAdd(form).then((res) => {
|
|
|
console.log("添加云盒信息", res);
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success(`成功添加云盒!`);
|
|
@@ -341,11 +360,11 @@ export default {
|
|
|
},
|
|
|
changeShop(e) {
|
|
|
if (e.at(-1)) {
|
|
|
- this.params.shopId = e.filter((v) => {
|
|
|
+ this.params.shopIdList = e.filter((v) => {
|
|
|
return v;
|
|
|
});
|
|
|
} else {
|
|
|
- this.params.shopId = [0];
|
|
|
+ this.params.shopIdList = [0];
|
|
|
}
|
|
|
},
|
|
|
changePrinterShop(e) {
|
|
@@ -359,16 +378,16 @@ export default {
|
|
|
},
|
|
|
changeDmPaperSize(e) {
|
|
|
if (e === 9) {
|
|
|
- this.params.dmPaperWidth = 210;
|
|
|
- this.params.dmPaperLength = 297;
|
|
|
+ this.params.cardWidth = 210;
|
|
|
+ this.params.cardHeight = 297;
|
|
|
}
|
|
|
if (e === 11) {
|
|
|
- this.params.dmPaperWidth = 148;
|
|
|
- this.params.dmPaperLength = 210;
|
|
|
+ this.params.cardWidth = 148;
|
|
|
+ this.params.cardHeight = 210;
|
|
|
}
|
|
|
if (e === 0) {
|
|
|
- this.params.dmPaperWidth = 195;
|
|
|
- this.params.dmPaperLength = 145;
|
|
|
+ this.params.cardWidth = 195;
|
|
|
+ this.params.cardHeight = 145;
|
|
|
}
|
|
|
},
|
|
|
deletePrinter(v) {
|
|
@@ -382,10 +401,10 @@ export default {
|
|
|
deviceDelete({ id: v.id }).then((res) => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message({
|
|
|
- type: "error",
|
|
|
+ type: "success",
|
|
|
message: "删除成功!",
|
|
|
});
|
|
|
- this.refreshData();
|
|
|
+ this.getCloudPrinterList();
|
|
|
} else {
|
|
|
this.$message({
|
|
|
type: "error",
|
|
@@ -426,11 +445,28 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ getCloudConfigList() {
|
|
|
+ cloudConfigList({ deviceType: 28 }).then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.configList = res.data;
|
|
|
+ let data = this.$tool.deepClone(res.data[0]);
|
|
|
+ data.shopIdList = [0]
|
|
|
+ this.params = data;
|
|
|
+ console.log("params:", this.params);
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "error",
|
|
|
+ message: res.msg,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|
|
|
this.getNewShopList();
|
|
|
this.getCloudPrinterList();
|
|
|
+ this.getCloudConfigList();
|
|
|
},
|
|
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted() {},
|