Преглед изворни кода

fix(print): support printTemplateId in ticket data and improve UI

- Update `PrintTemplate.vue` to use `printTemplateId` for template selection
- Pass `printTemplateId` when saving/updating ticket information in `FormInfo.vue`
- Add a tooltip title to the info icon in `TicketList.vue`
- Clean up console logs in `PrintTemplate.vue`
LaveyD пре 6 дана
родитељ
комит
929f8e7c3e

+ 6 - 4
src/components/PrintTemplate.vue

@@ -417,7 +417,6 @@ export default {
       return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
     },
     startPrint () {
-      console.log('currentTicket', this.currentTicket)
       const webview = document.querySelector('#printWebview')
       let printDoc = this.$refs.printMe.outerHTML
       // if (this.preview) {
@@ -456,8 +455,11 @@ export default {
       handler (val) {
         if (!val) return
         let target
-        if (val.print_model_id !== 0) {
-          target = this.$store.state.app.printTemplateList.find(i => i.id === val.print_model_id)
+        const printTemplateId = val.printTemplateId || val.print_model_id
+        console.log('current ticket printTemplateId', printTemplateId)
+
+        if (printTemplateId !== 0) {
+          target = this.$store.state.app.printTemplateList.find(i => i.id === printTemplateId)
         } else {
           let id = this.$localStore.get('defaultTemplate')
           target = this.$store.state.app.printTemplateList.find(i => i.id === id)
@@ -485,7 +487,7 @@ export default {
           if (this.currentTicket.allInvoiceQrcode) {
             this.afpImg = await QRCode.toDataURL(this.currentTicket.allInvoiceQrcode, opts)
           }
-          console.warn(this.currentTicket)
+          console.warn('print ticket', this.currentTicket)
           if (this.preview) return
 
           setTimeout(() => {

+ 1 - 0
src/pages/sellManage/common/TicketList.vue

@@ -155,6 +155,7 @@
               停售
             </div>
             <div class="title">
+              <i class="el-icon-info" style="cursor: pointer; margin-right: 8px;" title="查看票种详情" @click.stop="showTicketInfo(item)"></i>
               <el-tooltip
                 :content="getTicketTip(item)"
                 placement="top"

+ 5 - 3
src/pages/sellManage/retail/FormInfo.vue

@@ -493,7 +493,7 @@ export default {
           this.syncTouristList()
           const { playDateBegin, playDateEnd } = this.form
           const { currentBatch } = this
-          const { id, name, checkCount, isUseDateLimit } = this.currentTicket
+          const { id, name, checkCount, isUseDateLimit, printTemplateId } = this.currentTicket
           const price = this.currentPrice
           const originalPrice = this.currentPrice
 
@@ -543,7 +543,8 @@ export default {
               isPrepare: this.form.checkWay === 5 ? 1 : 0,
               pricePlanId: this.currentPlan || 0,
               playDateBegin: pdb,
-              playDateEnd: pde
+              playDateEnd: pde,
+              printTemplateId
             }
           })
 
@@ -582,7 +583,8 @@ export default {
                 this.currentPlan,
                 price,
                 playDateBegin: pdb,
-                playDateEnd: pde
+                playDateEnd: pde,
+                printTemplateId
               },
               tickets
             })