var app = getApp(); Component({ addGlobalClass: true, /** * 组件的属性列表 */ properties: { invoiceData: { type: Object, default: () => { return {}; } }, }, pageLifetimes: { show: function () {}, }, /** * 组件的初始数据 */ data: { showInvoice: false, invoicename: '', companyname: '', invoice_list: { call: "", company_number: "", email: "", invoice_type: 'electron', invoice_status: 'person', } }, /** * 组件的方法列表 */ methods: { show1btn() { this.setData({ showInvoice: true, }); }, closePopup() { this.setData({ showInvoice: false, }); }, callinp(e) { let val = e.detail.value; this.setData({ "invoice_list.call": val, }); }, emailinp(e) { let val = e.detail.value; this.setData({ "invoice_list.email": val, }); }, companyNumberinp(e) { let val = e.detail.value; this.setData({ "invoice_list.company_number": val, }); }, invoice_type(e) { let type = e.currentTarget.dataset.type; this.setData({ "invoice_list.invoice_type": type, }); }, invoice_title(e) { let type = e.currentTarget.dataset.type; this.setData({ "invoice_list.invoice_status": type, }); // 清空填写 this.setData({ "invoice_list.call": "", "invoice_list.company_number": "", "invoice_list.email": "", }); this.triggerEvent('subInvoice', this.data.invoice_list); }, Subinvoice() { if (app._isTextEmpty(this.data.invoice_list.call)) { wx.showToast({ title: "请填写抬头", icon: "none", duration: 1500, }); return; } if (this.data.iscur_b && app._isTextEmpty(this.data.invoice_list.company_number)) { wx.showToast({ title: "请添加纳税人识别号", icon: "none", duration: 1500, }); return; } // 页面回显 this.setData({ invoicename: this.data.invoice_list.invoice_type === 'electron' ? "电子" : "纸质", companyname: this.data.invoice_list.invoice_status === 'person' ? "个人" : "单位", showInvoiceTitle: this.data.invoice_list.call, showInvoice: false, }); this.triggerEvent('subInvoice', this.data.invoice_list); }, } });