greetingCardPrinter.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937
  1. <template>
  2. <div class="card-print">
  3. <div class="model">
  4. <div class="title">
  5. <div class="name">贺卡打印</div>
  6. </div>
  7. <div class="printer-list">
  8. <div class="item" v-for="(v,i) in printerList" :key="i">
  9. <img class="img" :src="require(`../../../../static/image/printer-online-1.png`)" alt="">
  10. <div class="name">{{v.name}}</div>
  11. <div class="shop-name">{{v.shopName}}</div>
  12. <div class="btns">
  13. <!-- <img @click.stop="printTest(v)" src="../../../../static/image/print-icon.png" alt=""> -->
  14. <img @click.stop="addPrinter(v)" src="../../../../static/image/edit-icon.png" alt="">
  15. <img @click.stop="deletePrinter(v)" src="../../../../static/image/delete-icon.png" alt="">
  16. </div>
  17. </div>
  18. <div class="item" @click.stop="addPrinter('')">
  19. <img class="img" src="../../../../static/image/icon-add.png" alt="">
  20. <div class="name">添加打印云盒</div>
  21. <div class="shop-name"> </div>
  22. </div>
  23. </div>
  24. <div class="setting-model">
  25. <div class="list">
  26. <div class="item" v-for="(v,i) in list" :key=i>
  27. <div class="left">
  28. <div class="left-top">
  29. <div class="name">{{v.name}}</div>
  30. </div>
  31. <div class="left-bot">{{v.tips}}</div>
  32. </div>
  33. <div class="right">
  34. <el-switch @change="change(v)" v-model="v.value" :active-value="1" :inactive-value="0" active-color="#FC7200" inactive-color="#999" />
  35. </div>
  36. </div>
  37. <div class="item">
  38. <div class="left">
  39. <div class="left-top">
  40. <div class="name">设置贺卡样式</div>
  41. </div>
  42. <div class="left-bot">设置贺卡尺寸、间距以及字体样式</div>
  43. </div>
  44. </div>
  45. <div class="card-setting">
  46. <div class="card-left" :style="`max-height: ${params.cardHeight}mm;max-width: ${params.cardWidth}mm;`">
  47. <i class="el-icon-arrow-down icon1" :style="`top:${params.paddingTop}mm;left:${params.paddingLeft}mm;`"></i>
  48. <i class="el-icon-arrow-down icon2" :style="`top:${params.paddingTop}mm;right:${params.paddingRight}mm;`"></i>
  49. <i class="el-icon-arrow-down icon3" :style="`bottom:${params.paddingBottom}mm;left:${params.paddingLeft}mm;`"></i>
  50. <i class="el-icon-arrow-down icon4" :style="`bottom:${params.paddingBottom}mm;right:${params.paddingRight}mm;`"></i>
  51. <div v-html="cardHtml"></div>
  52. </div>
  53. <div class="card-right">
  54. <div class="setting-params">
  55. <div class="card-title">所属门店<div class="card-tip">&emsp;(设置门店专属贺卡样式)</div>
  56. </div>
  57. <el-select v-model="params.shopIdList" multiple @change="changeShop" clearable>
  58. <el-option v-for="item in shopList" :key="item.id" :value="item.id" :label="item.name">
  59. <div>{{ item.name }}</div>
  60. </el-option>
  61. </el-select>
  62. </div>
  63. <div class="setting-params">
  64. <div class="card-title">贺卡字体</div>
  65. <el-select v-model="params.fontFamily">
  66. <el-option v-for="item in fonts" :key="item.value" :value="item.value" :label="item.name">
  67. <div :style="`font-family: ${item.value};font-size:20px;`">{{ item.name }}</div>
  68. </el-option>
  69. </el-select>
  70. </div>
  71. <div class="setting-params">
  72. <div class="card-title">打印方向</div>
  73. <el-select v-model="params.direction">
  74. <el-option v-for="item in directonList" :key="item.value" :value="item.value" :label="item.name">
  75. <div>{{ item.name }}</div>
  76. </el-option>
  77. </el-select>
  78. </div>
  79. <div class="setting-params">
  80. <div class="card-title">内容位置</div>
  81. <el-select v-model="params.textAlign">
  82. <el-option v-for="item in textAlignList" :key="item.value" :value="item.value" :label="item.name">
  83. <div>{{ item.name }}</div>
  84. </el-option>
  85. </el-select>
  86. </div>
  87. <div class="setting-params">
  88. <div class="card-title">贺卡尺寸类型</div>
  89. <el-select v-model="params.sizeType" @change="changeDmPaperSize">
  90. <el-option v-for="item in paperSize" :key="item.value" :value="item.value" :label="item.name">
  91. <div>{{ item.name }}</div>
  92. </el-option>
  93. </el-select>
  94. </div>
  95. <div class="setting-params">
  96. <div class="card-title">贺卡尺寸</div>
  97. <el-input :disabled="[9,11].includes(params.sizeType)" v-model="params.cardWidth">
  98. <template slot="prepend">宽</template>
  99. <template slot="append">毫米</template>
  100. </el-input>
  101. <el-input :disabled="[9,11].includes(params.sizeType)" v-model="params.cardHeight">
  102. <template slot="prepend">高</template>
  103. <template slot="append">毫米</template>
  104. </el-input>
  105. </div>
  106. <div class="setting-params">
  107. <div class="card-title">贺卡内容间距</div>
  108. <el-input v-model="params.paddingTop">
  109. <template slot="prepend">上</template>
  110. <template slot="append">毫米</template>
  111. </el-input>
  112. <el-input v-model="params.paddingBottom">
  113. <template slot="prepend">下</template>
  114. <template slot="append">毫米</template>
  115. </el-input>
  116. <el-input v-model="params.paddingLeft">
  117. <template slot="prepend">左</template>
  118. <template slot="append">毫米</template>
  119. </el-input>
  120. <el-input v-model="params.paddingRight">
  121. <template slot="prepend">右</template>
  122. <template slot="append">毫米</template>
  123. </el-input>
  124. </div>
  125. <div class="btns">
  126. <el-button size="small" @click="saveCard" type="warning">保存贺卡</el-button>
  127. <el-button size="small" @click="printTest">打印测试页</el-button>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. <!-- 新增、编辑云盒 -->
  135. <el-dialog title="云盒管理" :visible.sync="dialogVisible" width="600px">
  136. <el-form ref="form" :model="form" label-width="120px">
  137. <el-form-item label="云盒名称">
  138. <el-input v-model="form.name" clearable placeholder="请自定义云盒名称"></el-input>
  139. </el-form-item>
  140. <el-form-item label="云盒序列号">
  141. <el-input v-model="form.deviceSn" clearable placeholder="请填写云盒序列号"></el-input>
  142. </el-form-item>
  143. <el-form-item label="云盒秘钥">
  144. <el-input v-model="form.deviceSecret" clearable placeholder="请填写云盒秘钥"></el-input>
  145. </el-form-item>
  146. <el-form-item label="关联门店">
  147. <el-select style="width:300px;" clearable v-model="form.shopIdList" multiple @change="changePrinterShop" max-width="300px">
  148. <el-option v-for="item in shopList" :key="item.id" :value="item.id" :label="item.name">
  149. <div>{{ item.name }}</div>
  150. </el-option>
  151. </el-select>
  152. </el-form-item>
  153. <el-form-item label="选择打印机">
  154. <el-select style="width:300px;" v-model="form.deviceName" placeholder="请选择打印机">
  155. <el-option v-for="item in cloudList" :key="item.id" :value="`${ item.printerName }(USB${item.port})`">
  156. <div>{{ item.printerName }}(USB{{item.port}})</div>
  157. </el-option>
  158. </el-select>
  159. <el-button type="success" @click="getCloudPrinterInfo">获取打印机信息</el-button>
  160. </el-form-item>
  161. </el-form>
  162. <span slot="footer" class="dialog-footer">
  163. <el-button @click="dialogVisible = false">取 消</el-button>
  164. <el-button type="primary" @click="cloudPrinterManager">确 定</el-button>
  165. </span>
  166. </el-dialog>
  167. </div>
  168. </template>
  169. <script>
  170. import {
  171. getNewShopList,
  172. getCloudDevice,
  173. deviceAdd,
  174. cloudPrint,
  175. shopDeviceList,
  176. deviceDelete,
  177. cloudConfigList,
  178. cloudConfigAdd,
  179. } from "../../../api/shop";
  180. export default {
  181. name: "greetingCardPrinter",
  182. components: {},
  183. data() {
  184. return {
  185. list: [
  186. {
  187. name: "开启贺卡打印",
  188. value: 1,
  189. field: "openAutoorder",
  190. tips: "开启后订单一键打印贺卡,暂不支持自动打印",
  191. },
  192. ],
  193. form: {
  194. name: "",
  195. deviceSn: "lk10gy13861829",
  196. deviceSecret: "2Vy7D5sDDjUI2DZs",
  197. shopIdList: [0],
  198. deviceName: "",
  199. deviceType: 28,
  200. shopId: 0,
  201. },
  202. cloudList: [],
  203. configList: [],
  204. params: {
  205. cardWidth: 210,
  206. cardHeight: 297,
  207. paddingTop: 10,
  208. paddingBottom: 10,
  209. paddingLeft: 10,
  210. paddingRight: 10,
  211. direction: 1, // 1:竖向 2:横向
  212. fontFamily: "FangZhengKaiTi",
  213. shopIdList: [0],
  214. sizeType: 9, // 纸张尺寸
  215. textAlign: 5,
  216. },
  217. printerList: [],
  218. shopList: [],
  219. fonts: [
  220. {
  221. name: "方正楷体",
  222. value: "FangZhengKaiTi",
  223. },
  224. {
  225. name: "沐瑶随心手写体",
  226. value: "YaoSuiXinShouXieTi",
  227. },
  228. {
  229. name: "钟奇志莽行书",
  230. value: "ZhongQiZhiXingShu",
  231. },
  232. {
  233. name: "鸿雷板书简体",
  234. value: "HongLeiBanShu",
  235. },
  236. {
  237. name: "卡通体",
  238. value: "KaTongTi",
  239. },
  240. {
  241. name: "品如手写体",
  242. value: "PinRu",
  243. },
  244. {
  245. name: "千图笔锋手写体",
  246. value: "QianTuBiFengShouXieTi",
  247. },
  248. {
  249. name: "悠然小楷",
  250. value: "slideyouran",
  251. },
  252. ],
  253. paperSize: [
  254. {
  255. name: "A4",
  256. value: 9,
  257. },
  258. {
  259. name: "A5",
  260. value: 11,
  261. },
  262. {
  263. name: "自定义",
  264. value: 0,
  265. },
  266. ],
  267. directonList: [
  268. {
  269. name: "竖向",
  270. value: 1,
  271. },
  272. {
  273. name: "横向",
  274. value: 2,
  275. },
  276. ],
  277. textAlignList: [
  278. {
  279. name: "左上",
  280. value: 1,
  281. },
  282. {
  283. name: "左中",
  284. value: 2,
  285. },
  286. {
  287. name: "左下",
  288. value: 3,
  289. },
  290. {
  291. name: "中上",
  292. value: 4,
  293. },
  294. {
  295. name: "中",
  296. value: 5,
  297. },
  298. {
  299. name: "中下",
  300. value: 6,
  301. },
  302. {
  303. name: "右上",
  304. value: 7,
  305. },
  306. {
  307. name: "右中",
  308. value: 8,
  309. },
  310. {
  311. name: "右下",
  312. value: 9,
  313. },
  314. ],
  315. dialogVisible: false,
  316. };
  317. },
  318. // 监听属性 类似于data概念
  319. computed: {
  320. cardHtml() {
  321. return `<style type="text/css">
  322. @font-face {
  323. font-family: ${this.params.fontFamily};
  324. src: url('https://h5.liebaoai.cn/font/${
  325. this.params.fontFamily
  326. }.woff2');
  327. font-weight: normal;
  328. font-style: normal;
  329. }
  330. .card-left {
  331. position: relative;
  332. height: ${this.params.cardHeight}mm;
  333. width: ${this.params.cardWidth}mm;
  334. display:flex;
  335. ${this.contentStyle(this.params.direction)[0]}
  336. }
  337. .card-con {
  338. margin-top: ${this.params.paddingTop}mm;
  339. margin-right: ${this.params.paddingRight}mm;
  340. margin-bottom: ${this.params.paddingBottom}mm;
  341. margin-left: ${this.params.paddingLeft}mm;
  342. font-size:35px;
  343. font-family: ${this.params.fontFamily};
  344. ${this.contentStyle(this.params.direction)[1]}
  345. }
  346. </style>
  347. <div class="card-left">
  348. <div class="card-con">亲爱的,生日快乐!</div>
  349. </div>`;
  350. },
  351. },
  352. // 监控data中的数据变化
  353. watch: {
  354. "params.shopIdList": {
  355. handler(newVal, oldVal) {
  356. console.log("newVal,oldVal:", newVal, oldVal);
  357. if (newVal[0] !== oldVal[0]) {
  358. let data = this.configList.find((v) => {
  359. return v.shopId === newVal[0];
  360. });
  361. if (!data) {
  362. data = this.configList[0];
  363. }
  364. data.shopIdList = newVal;
  365. this.params = data;
  366. }
  367. },
  368. deep: true,
  369. },
  370. },
  371. // 方法集合
  372. methods: {
  373. saveCard() {
  374. cloudConfigAdd(this.params).then((res) => {
  375. console.log("添加贺卡配置信息", res);
  376. if (res.code === 200) {
  377. this.$message.success(`保存贺卡成功!`);
  378. this.getCloudConfigList();
  379. } else {
  380. this.$message({
  381. type: "error",
  382. message: res.msg,
  383. });
  384. }
  385. });
  386. },
  387. printTest() {
  388. let html = this.cardHtml;
  389. if (this.params.direction === 2) {
  390. html = `<style type="text/css">
  391. @font-face {
  392. font-family: ${this.params.fontFamily};
  393. src: url('https://h5.liebaoai.cn/font/${
  394. this.params.fontFamily
  395. }.woff2');
  396. font-weight: normal;
  397. font-style: normal;
  398. }
  399. .card-left {
  400. position: relative;
  401. height: ${this.params.cardWidth}mm;
  402. width: ${this.params.cardHeight}mm;
  403. display:flex;
  404. ${this.contentStyle(1)[0]}
  405. }
  406. .card-con {
  407. margin-top: ${this.params.paddingTop}mm;
  408. margin-right: ${this.params.paddingRight}mm;
  409. margin-bottom: ${this.params.paddingBottom}mm;
  410. margin-left: ${this.params.paddingLeft}mm;
  411. font-size:35px;
  412. font-family: ${this.params.fontFamily};
  413. ${this.contentStyle(1)[1]}
  414. }
  415. </style>
  416. <div class="card-left">
  417. <div class="card-con">亲爱的,生日快乐!</div>
  418. </div>`;
  419. }
  420. let params = {
  421. orderId: 0,
  422. shopId: this.params.shopIdList[0],
  423. jobFile: html,
  424. };
  425. cloudPrint(params).then((res) => {
  426. console.log("云盒打印信息", res);
  427. if (res.code === 200) {
  428. this.$message({
  429. type: "success",
  430. message: `成功发送云盒打印任务!`,
  431. });
  432. } else {
  433. this.$message({
  434. type: "error",
  435. message: res.msg,
  436. });
  437. }
  438. });
  439. },
  440. cloudPrinterManager() {
  441. if (!this.form.name) {
  442. return this.$message.warning(`请输入云盒名称!`);
  443. }
  444. if (!this.form.deviceSn) {
  445. return this.$message.warning(`请输入云盒序列号!`);
  446. }
  447. if (!this.form.deviceSecret) {
  448. return this.$message.warning(`请输入云盒秘钥!`);
  449. }
  450. let form = this.$tool.deepClone(this.form);
  451. form.shopIds = form.shopIdList.join();
  452. deviceAdd(form).then((res) => {
  453. console.log("添加云盒信息", res);
  454. if (res.code === 200) {
  455. this.$message.success(`成功添加云盒!`);
  456. this.dialogVisible = false;
  457. this.getCloudPrinterList();
  458. } else {
  459. this.$message({
  460. type: "error",
  461. message: res.msg,
  462. });
  463. }
  464. });
  465. },
  466. getCloudPrinterInfo() {
  467. let params = {
  468. deviceId: this.form.deviceSn,
  469. deviceKey: this.form.deviceSecret,
  470. printerType: 1,
  471. };
  472. getCloudDevice(params).then((res) => {
  473. console.log("云盒信息", res);
  474. if (!res.code) {
  475. this.cloudList = res.data;
  476. let cloud = this.cloudList[0];
  477. if (!cloud) return;
  478. this.form.deviceName = `${cloud.printerName}(USB${cloud.port})`;
  479. } else {
  480. this.$message({
  481. type: "error",
  482. message: res.msg,
  483. });
  484. }
  485. });
  486. },
  487. addPrinter(v) {
  488. this.dialogVisible = true;
  489. if (v) this.form = v;
  490. if (this.form.id) return;
  491. this.form.name = `贺卡打印云盒${new Date().getTime()}`;
  492. },
  493. changeShop(e) {
  494. if (e.at(-1)) {
  495. this.params.shopIdList = e.filter((v) => {
  496. return v;
  497. });
  498. } else {
  499. this.params.shopIdList = [0];
  500. }
  501. },
  502. changePrinterShop(e) {
  503. if (e.at(-1)) {
  504. this.form.shopIdList = e.filter((v) => {
  505. return v;
  506. });
  507. } else {
  508. this.form.shopIdList = [0];
  509. }
  510. },
  511. changeDmPaperSize(e) {
  512. if (e === 9) {
  513. this.params.cardWidth = 210;
  514. this.params.cardHeight = 297;
  515. }
  516. if (e === 11) {
  517. this.params.cardWidth = 148;
  518. this.params.cardHeight = 210;
  519. }
  520. if (e === 0) {
  521. this.params.cardWidth = 195;
  522. this.params.cardHeight = 145;
  523. }
  524. },
  525. deletePrinter(v) {
  526. this.$confirm("此操作将删除打印云盒, 是否继续?", "提示", {
  527. confirmButtonText: "确定",
  528. cancelButtonText: "取消",
  529. type: "warning",
  530. center: true,
  531. })
  532. .then(() => {
  533. deviceDelete({ id: v.id }).then((res) => {
  534. if (res.code === 200) {
  535. this.$message({
  536. type: "success",
  537. message: "删除成功!",
  538. });
  539. this.getCloudPrinterList();
  540. } else {
  541. this.$message({
  542. type: "error",
  543. message: res.msg,
  544. });
  545. }
  546. });
  547. })
  548. .catch(() => {
  549. this.$message({
  550. type: "info",
  551. message: "已取消删除",
  552. });
  553. });
  554. },
  555. getNewShopList() {
  556. getNewShopList().then((res) => {
  557. if (res.code === 200) {
  558. res.data.unshift({ id: 0, name: "全部门店" });
  559. this.shopList = res.data;
  560. } else {
  561. this.$message({
  562. type: "error",
  563. message: res.msg,
  564. });
  565. }
  566. });
  567. },
  568. getCloudPrinterList() {
  569. shopDeviceList({ deviceType: 28 }).then((res) => {
  570. if (res.code === 200) {
  571. this.printerList = res.data;
  572. } else {
  573. this.$message({
  574. type: "error",
  575. message: res.msg,
  576. });
  577. }
  578. });
  579. },
  580. getCloudConfigList() {
  581. cloudConfigList({ deviceType: 28 }).then((res) => {
  582. if (res.code === 200) {
  583. this.configList = res.data;
  584. let data = res.data.find((v) => {
  585. return v.shopId === this.params.shopIdList[0];
  586. });
  587. data.shopIdList = [data.shopId];
  588. this.params = data;
  589. } else {
  590. this.$message({
  591. type: "error",
  592. message: res.msg,
  593. });
  594. }
  595. });
  596. },
  597. contentStyle(direction) {
  598. let style = ``;
  599. let transform = ``;
  600. if (direction === 1) {
  601. switch (this.params.textAlign) {
  602. case 1:
  603. style = `justify-content:flex-start;align-items:flex-start;`;
  604. break;
  605. case 2:
  606. style = `justify-content:flex-start;align-items:center;`;
  607. break;
  608. case 3:
  609. style = `justify-content:flex-start;align-items:flex-end;`;
  610. break;
  611. case 4:
  612. style = `justify-content:center;align-items:flex-start;`;
  613. break;
  614. case 5:
  615. style = `justify-content:center;align-items:center;`;
  616. break;
  617. case 6:
  618. style = `justify-content:center;align-items:flex-end;`;
  619. break;
  620. case 7:
  621. style = `justify-content:flex-end;align-items:flex-start;`;
  622. break;
  623. case 8:
  624. style = `justify-content:flex-end;align-items:center;`;
  625. break;
  626. case 9:
  627. style = `justify-content:flex-end;align-items:flex-end;`;
  628. break;
  629. default:
  630. break;
  631. }
  632. } else {
  633. switch (this.params.textAlign) {
  634. case 1:
  635. style = `justify-content:flex-end;align-items:flex-start;`;
  636. transform = `transform: translateX(100%) rotate(90deg);transform-origin: left top;`;
  637. break;
  638. case 2:
  639. style = `justify-content:center;align-items:flex-start;`;
  640. transform = `transform: translateX(50%) translateY(-50%) rotate(90deg);transform-origin: left;`;
  641. break;
  642. case 3:
  643. style = `justify-content:flex-start;align-items:flex-start;`;
  644. transform = `transform: translateY(-100%) rotate(90deg);transform-origin: left bottom;`;
  645. break;
  646. case 4:
  647. style = `justify-content:flex-end;align-items:center;`;
  648. transform = `transform: translateX(50%) rotate(90deg);transform-origin: center top;`;
  649. break;
  650. case 5:
  651. style = `justify-content:center;align-items:center;`;
  652. transform = `transform: rotate(90deg);`;
  653. break;
  654. case 6:
  655. style = `justify-content:flex-start;align-items:center;`;
  656. transform = `transform: translateX(-50%) rotate(90deg);`;
  657. break;
  658. case 7:
  659. style = `justify-content:flex-end;align-items:flex-end;`;
  660. transform = `transform: translatey(100%) rotate(90deg);transform-origin: right top;`;
  661. break;
  662. case 8:
  663. style = `justify-content:center;align-items:flex-end;`;
  664. transform = `transform: translateX(-50%) translateY(50%) rotate(90deg);transform-origin:right;`;
  665. break;
  666. case 9:
  667. style = `justify-content:flex-start;align-items:flex-end;`;
  668. transform = `transform: translateX(-100%) rotate(90deg);transform-origin:right bottom;`;
  669. break;
  670. default:
  671. break;
  672. }
  673. }
  674. return [style, transform];
  675. },
  676. },
  677. // 生命周期 - 创建完成(可以访问当前this实例)
  678. created() {
  679. this.getNewShopList();
  680. this.getCloudPrinterList();
  681. this.getCloudConfigList();
  682. },
  683. // 生命周期 - 挂载完成(可以访问DOM元素)
  684. mounted() {},
  685. // 生命周期 - 创建之前
  686. beforeCreate() {},
  687. // 生命周期 - 挂载之前
  688. beforeMount() {},
  689. // 生命周期 - 更新之前
  690. beforeUpdate() {},
  691. // 生命周期 - 更新之后
  692. updated() {},
  693. // 生命周期 - 销毁之前
  694. beforeDestroy() {},
  695. // 生命周期 - 销毁完成
  696. destroyed() {},
  697. // 如果页面有keep-alive缓存功能,这个函数会触发
  698. activated() {},
  699. };
  700. </script>
  701. <style lang="scss" scoped type="text/css">
  702. .model {
  703. .title {
  704. position: relative;
  705. display: flex;
  706. align-items: center;
  707. font-size: 16px;
  708. font-weight: bold;
  709. line-height: 22px;
  710. color: #333333;
  711. padding-left: 10px;
  712. margin-top: 24px;
  713. }
  714. .title::before {
  715. width: 3px;
  716. height: 16px;
  717. background: rgba(252, 114, 0, 0.39);
  718. border-radius: 2px;
  719. content: "";
  720. position: absolute;
  721. top: 2px;
  722. left: 0;
  723. }
  724. /deep/ .el-button--default:hover {
  725. background-color: rgba(252, 114, 0, 0.2);
  726. border-color: rgba(252, 114, 0, 0.2);
  727. color: #fc7200;
  728. }
  729. /deep/ .el-button--primary {
  730. background-color: #fc7200;
  731. border-color: #fc7200;
  732. }
  733. .setting-model {
  734. .title {
  735. position: relative;
  736. font-size: 16px;
  737. font-weight: bold;
  738. line-height: 22px;
  739. color: #333333;
  740. padding-left: 10px;
  741. margin-top: 24px;
  742. .tips {
  743. font-size: 14px;
  744. font-weight: 400;
  745. line-height: 22px;
  746. color: #999999;
  747. }
  748. }
  749. .title::before {
  750. width: 3px;
  751. height: 16px;
  752. background: #fc7200;
  753. border-radius: 2px;
  754. content: "";
  755. position: absolute;
  756. top: 2px;
  757. left: 0;
  758. }
  759. .list {
  760. .item {
  761. display: flex;
  762. justify-content: space-between;
  763. align-items: center;
  764. background: #ffffff;
  765. margin-top: 10px;
  766. padding: 16px 20px;
  767. .left {
  768. display: flex;
  769. flex-direction: column;
  770. font-size: 14px;
  771. font-weight: bold;
  772. line-height: 20px;
  773. color: #000000;
  774. .left-top {
  775. display: flex;
  776. align-items: center;
  777. .set {
  778. font-weight: 400;
  779. color: #fc7200;
  780. margin-left: 10px;
  781. cursor: pointer;
  782. }
  783. }
  784. .left-bot {
  785. margin-top: 2px;
  786. font-size: 12px;
  787. font-weight: 400;
  788. line-height: 17px;
  789. color: #999999;
  790. }
  791. }
  792. .right {
  793. display: flex;
  794. align-items: center;
  795. .time {
  796. font-size: 12px;
  797. font-family: PingFang SC;
  798. font-weight: 400;
  799. line-height: 17px;
  800. color: #333333;
  801. margin-right: 20px;
  802. }
  803. .time1 {
  804. color: #999999;
  805. }
  806. .con {
  807. font-size: 14px;
  808. font-weight: 400;
  809. line-height: 20px;
  810. color: #fc7200;
  811. padding-left: 20px;
  812. cursor: pointer;
  813. }
  814. .con1 {
  815. color: #999999;
  816. }
  817. }
  818. }
  819. .card-setting {
  820. display: flex;
  821. margin-top: 10px;
  822. .card-title {
  823. display: flex;
  824. align-items: center;
  825. font-weight: bold;
  826. font-size: 14px;
  827. margin: 10px 0;
  828. .card-tip {
  829. font-size: 12px;
  830. color: #fc7200;
  831. }
  832. }
  833. .card-right {
  834. width: 230px;
  835. flex-shrink: 0;
  836. .setting-params {
  837. width: 217px;
  838. }
  839. .btns {
  840. margin-top: 20px;
  841. display: flex;
  842. justify-content: space-between;
  843. }
  844. }
  845. .card-left {
  846. position: relative;
  847. margin-right: 24px;
  848. background-color: #fbfbfb;
  849. flex-shrink: 0;
  850. flex: 1;
  851. // height: 297mm;
  852. // width: 210mm;
  853. .card-con {
  854. position: relative;
  855. top: 50%;
  856. transform: translateY(-50%);
  857. text-align: center;
  858. }
  859. /deep/ .el-icon-arrow-down {
  860. position: absolute;
  861. font-size: 30px;
  862. }
  863. .icon1 {
  864. top: 10mm;
  865. left: 10mm;
  866. transform: rotate(-45deg);
  867. }
  868. .icon2 {
  869. top: 10mm;
  870. right: 10mm;
  871. transform: rotate(45deg);
  872. }
  873. .icon3 {
  874. bottom: 10mm;
  875. left: 10mm;
  876. transform: rotate(-135deg);
  877. }
  878. .icon4 {
  879. bottom: 10mm;
  880. right: 10mm;
  881. transform: rotate(135deg);
  882. }
  883. }
  884. }
  885. }
  886. }
  887. .printer-list {
  888. display: flex;
  889. flex-wrap: wrap;
  890. .item {
  891. position: relative;
  892. display: flex;
  893. flex-direction: column;
  894. align-items: center;
  895. justify-content: center;
  896. width: 320px;
  897. height: 182px;
  898. background: #ffffff;
  899. border-radius: 8px;
  900. margin: 10px 20px 0 0;
  901. cursor: pointer;
  902. .img {
  903. width: 80px;
  904. height: 80px;
  905. }
  906. .name {
  907. font-size: 14px;
  908. font-weight: 500;
  909. line-height: 20px;
  910. color: #333333;
  911. }
  912. .shop-name {
  913. font-size: 12px;
  914. font-weight: 400;
  915. line-height: 20px;
  916. color: #999999;
  917. }
  918. .btns {
  919. position: absolute;
  920. top: 10px;
  921. right: 0;
  922. img {
  923. width: 20px;
  924. height: 20px;
  925. margin-right: 10px;
  926. }
  927. }
  928. }
  929. }
  930. }
  931. </style>