| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <template>
- <div>
- <!-- 该组件用于加载一些全局数据,在布局组件 AppMain.vue 中加载,放在根路径是为了便于查找 -->
- </div>
- </template>
- <script>
- import { getIp } from '@/utils'
- import { getTicketPrintModelList, getReceiptPrintModel } from '@/api/printModal'
- import whitePaper from '@/pages/systemSetting/printManage/vertical'
- import defaultSmallTicket from '@/pages/systemSetting/smallTicket/defaultTemp'
- export default {
- created () {
- getIp()
- // 获取打印模板
- this.getTicketPrintModelList()
- this.$store.dispatch('setTravelAgencyType')
- // 获取所有票种列表
- this.$store.dispatch('getTicketTypeList')
- this.$store.dispatch('setCustomerType')
- // 设置全局 支付方式
- this.$store.dispatch('getPayChannel')
- // 获取票种分类
- // this.$store.dispatch('getTicketCategory')
- // 获取售票员列表
- this.$store.dispatch('getSalesList')
- // 获取自助机列表
- this.$store.dispatch('getTermDevices')
- // getMyAccount
- this.$store.dispatch('getMyAccount')
- // 获取销售渠道
- this.$store.dispatch('getSaleChannel')
- this.$store.dispatch('getSystemConfigList')
- // 获取旅行社列表
- // this.$store.dispatch('getAgencyList')
- // 获取景点列表
- this.$store.dispatch('getScenicList')
- // 获取账号信息
- // this.$store.dispatch('getAccount')
- // 获取场次信息
- // this.$store.dispatch('getBatchConfigList')
- },
- methods: {
- // 提前设置打印模板
- getTicketPrintModelList () {
- const params = {
- pageNum: 0,
- pageSize: -1,
- name: '',
- content: ''
- }
- getTicketPrintModelList(params).then(res => {
- const list = res.data.records || []
- let id = this.$localStore.get('defaultTemplate')
- let target = id ? list.find(i => i.id === id) : list.find(i => i.isDefault)
- // 设置当前打印模板
- this.$store.commit('SET_PRINT_TEMPLATE', target ? JSON.parse(target.content) : whitePaper)
- if (target) {
- this.$localStore.set('defaultTemplate', target.id)
- }
- // 设置打印模板列表
- list.length > 0 && this.$store.commit('SET_PRINT_TEMPLATE_LIST', list)
- })
- },
- getReceiptPrintModel () {
- getReceiptPrintModel().then(res => {
- let id = this.$localStore.get('defaultSmallTicketTemplate')
- const list = res.data.records || []
- let target = id ? list.find(i => i.id === id) : list.find(i => i.isDefault)
- // 设置当前打印模板
- target && this.$store.commit('SET_SMALL_TICKET_TEMPLATE', target ? JSON.parse(target.content) : defaultSmallTicket)
- if (target) {
- this.$localStore.set('defaultSmallTicketTemplate', target.id)
- }
- // 设置打印模板列表
- list.length > 0 && this.$store.commit('SET_SMALL_TICKET_TEMPLATE_LIST', res.list)
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|