|
@@ -204,7 +204,7 @@ export default {
|
|
|
paddingBottom: 10,
|
|
|
paddingLeft: 10,
|
|
|
paddingRight: 10,
|
|
|
- direction: 1, // 1:竖向 2:横向
|
|
|
+ direction: 1, // 1:竖向 2:横向左 3:横向右
|
|
|
fontFamily: "FangZhengKaiTi",
|
|
|
shopIdList: [0],
|
|
|
sizeType: 9, // 纸张尺寸
|
|
@@ -265,9 +265,13 @@ export default {
|
|
|
value: 1,
|
|
|
},
|
|
|
{
|
|
|
- name: "横向",
|
|
|
+ name: "横向左",
|
|
|
value: 2,
|
|
|
},
|
|
|
+ {
|
|
|
+ name: "横向右",
|
|
|
+ value: 3,
|
|
|
+ },
|
|
|
],
|
|
|
dialogVisible: false,
|
|
|
};
|
|
@@ -275,14 +279,31 @@ export default {
|
|
|
// 监听属性 类似于data概念
|
|
|
computed: {},
|
|
|
// 监控data中的数据变化
|
|
|
- watch: {},
|
|
|
+ watch: {
|
|
|
+ "params.shopIdList": {
|
|
|
+ handler(newVal, oldVal) {
|
|
|
+ console.log("newVal,oldVal:", newVal, oldVal);
|
|
|
+ if (newVal[0] !== oldVal[0]) {
|
|
|
+ let data = this.configList.find((v) => {
|
|
|
+ return v.shopId === newVal[0];
|
|
|
+ });
|
|
|
+ if (!data) {
|
|
|
+ data = this.configList[0];
|
|
|
+ }
|
|
|
+ data.shopIdList = newVal;
|
|
|
+ this.params = data;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
// 方法集合
|
|
|
methods: {
|
|
|
saveCard() {
|
|
|
cloudConfigAdd(this.params).then((res) => {
|
|
|
console.log("添加贺卡配置信息", res);
|
|
|
if (res.code === 200) {
|
|
|
- this.$message.success(`保存贺卡成功!`)
|
|
|
+ this.$message.success(`保存贺卡成功!`);
|
|
|
this.getCloudConfigList();
|
|
|
} else {
|
|
|
this.$message({
|
|
@@ -293,10 +314,52 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
printTest() {
|
|
|
- cloudPrint().then((res) => {
|
|
|
- console.log("添加云盒信息", res);
|
|
|
- if (!res.code) {
|
|
|
- this.cloudList = res.data;
|
|
|
+ let params = {
|
|
|
+ orderId: 0,
|
|
|
+ shopId: this.params.shopIdList[0],
|
|
|
+ jobFile: `<style type="text/css">
|
|
|
+ @font-face {
|
|
|
+ font-family: ${this.params.fontFamily};
|
|
|
+ src: url('https://h5.liebaoai.cn/font/${
|
|
|
+ this.params.fontFamily
|
|
|
+ }.woff2');
|
|
|
+ font-weight: normal;
|
|
|
+ font-style: normal;
|
|
|
+ }
|
|
|
+ .card-left {
|
|
|
+ position: relative;
|
|
|
+ ${
|
|
|
+ this.params.direction === 1
|
|
|
+ ? "height: 297mm;width: 210mm;"
|
|
|
+ : "width: 297mm;height: 210mm;"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .card-con {
|
|
|
+ position: relative;
|
|
|
+ top: 50%;
|
|
|
+ transform: translateY(-50%);
|
|
|
+ ${
|
|
|
+ this.params.direction === 1
|
|
|
+ ? "text-align: center;"
|
|
|
+ : this.params.direction === 2
|
|
|
+ ? "text-align: left;"
|
|
|
+ : "text-align: right;"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ <div class="card-left">
|
|
|
+ <div class="card-con" style="font-family: ${this.params.fontFamily};padding:${this.params.paddingTop}mm ${this.params.paddingRight}mm ${this.params.paddingBottom}mm ${this.params.paddingLeft}mm;">
|
|
|
+ <font size="6">亲爱的,生日快乐!希望你开心快乐每一天!</font>
|
|
|
+ </div>
|
|
|
+ </div>`,
|
|
|
+ };
|
|
|
+ cloudPrint(params).then((res) => {
|
|
|
+ console.log("云盒打印信息", res);
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: `成功发送云盒打印任务!`,
|
|
|
+ });
|
|
|
} else {
|
|
|
this.$message({
|
|
|
type: "error",
|
|
@@ -450,7 +513,7 @@ export default {
|
|
|
if (res.code === 200) {
|
|
|
this.configList = res.data;
|
|
|
let data = this.$tool.deepClone(res.data[0]);
|
|
|
- data.shopIdList = [0]
|
|
|
+ data.shopIdList = [0];
|
|
|
this.params = data;
|
|
|
console.log("params:", this.params);
|
|
|
} else {
|