/******************************************************************************* * Copyright(c) 2024 dongke All rights reserved. / Confidential * 类的信息: * 1.程序名称: * 2.功能描述:票据打印画面 * 编辑履历: * 作者 日期 版本 修改内容 * 周兴 2022-11-22 1.00 新建 *******************************************************************************/ const api = require('@/utils/api.js'); const config = require('@/config/config.js'); const app = getApp() Page({ /** * 页面的初始数据 */ data: { // 加入企业的列表 tableList: [], // 业务单据ID dataId:null, // 单据类型 docName:null, // 语言包 $t: app.globalData.lang, }, /** * @desc : 调取打印 * @author : 周兴 * @date : 2024/4/22 */ print(e) { let layoutId = e.currentTarget.dataset.item.layoutId; let docName = this.data.docName; let dataId = this.data.dataId; let url = config.image_url.replace('/file',''); wx.navigateTo({ url: '/package-base-select/pages/web-view-select/web-view-select', success: function (res) { res.eventChannel.emit('url', url + '/wx-print?svc_code=' + app.globalData.company.svcCode + '&cp_id=' + app.globalData.company.cpId + '&doc=' + docName + '&layout_id=' + layoutId + '&data_id=' + dataId); } }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { // 接收父页面传递的参数 const eventChannel = this.getOpenerEventChannel(); if (eventChannel && JSON.stringify(eventChannel) !== '{}') { let _this = this; // 指定类型 eventChannel.once('print', function (data) { _this.setData({ tableList: data.data, dataId:data.dataId, docName:data.docName }) }) } }, })