const util = require('../../../utils/util'); Page({ /** * 页面的初始数据 */ data: { // 修改开票信息图片 editInvoicImg: 'https://img.bbztx.com/image_test/upload/thumbs/20230211/logo/1676108882272014866.png', editDetail: {}, orderPassword: [], company: '', dutyNumber: '', //税号 email: '', attendantNamesList: [], //多个名字存放数组 }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { console.log(options); let detail = JSON.parse(options.detail) console.log(detail); this.setData({ editDetail: detail.data, company: detail.data.company, dutyNumber: detail.data.dutyNumber, email: detail.data.email, orderPassword: JSON.parse(detail.data.orderPassword), attendantNamesList: detail.info }) // console.log(detail); }, //输入框 bindinput(e) { let type = e.currentTarget.dataset.type let value = e.detail.value console.log(value); if (type == 'company') { this.setData({ company: value }) } if (type == 'dutyNumber') { this.setData({ dutyNumber: value }) } if (type == 'email') { this.setData({ email: value }) } }, //提交 submit() { // console.log(this.data.orderPassword, this.data.editDetail); let that = this // console.log(that.data.editDetail.company, that.data.editDetail.dutyNumber, that.data.editDetail.email); if (util.isEmpty(that.data.company)) { util.showTips('公司名称不能为空') } else if (util.isEmpty(that.data.dutyNumber)) { util.showTips('税号不能为空') } else if (util.isEmpty(that.data.email)) { util.showTips('邮箱不能为空') } else { // console.log(that.data.editDetail); let data = {} data.passwords = [that.data.orderPassword[0].password] data.type = 0 data.company = that.data.company data.dutyNumber = that.data.dutyNumber data.email = that.data.email data.isUpdate = true data.status = that.data.editDetail.status data.price = that.data.editDetail.price data.id = that.data.editDetail.id util.ajax({ func: "articleInvoice/save", data, method: 'POST', load:false, }, ({ data, code, reason }) => { if (code == 0) { console.log(data); var pages = getCurrentPages(); //当前页面 var beforePage = pages; //前一页 // console.log(pages); wx.navigateBack({ delta: 1, }) } else if (code == -1) { util.showTips(reason) } else if(code==-14) { // this.setData({ // showconsumptionCode: true // }) util.showTips(reason+',请返回上一页') } }) } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })