// pages/home/customer-info/index.js import { generateCode } from "../../../api/user" import { getCustomerInfo } from "../../../api/saas" const util = require('../../../utils/util') const app = getApp() Page({ /** * 页面的初始数据 */ data: { form: null, base64: null, showEmbedded: false }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if(options.id){ wx.showLoading({ title: '正在获取', mask: true }) getCustomerInfo(options.id).then(result => { wx.hideLoading() this.setData({ form: result.data }) }).catch(err => { wx.hideLoading() util.showToast(err) }) } }, onClickHideEmbedded: function(){ this.setData({ showEmbedded: false }) }, registCustomer: function(){ wx.showLoading({ title: '加载中', mask: true }) const params = { id: 6 } params.metaData = { factoryId: app.userInfo.factoryId, factoryName: app.userInfo.factoryName, factoryCustomerId: this.data.form.id } generateCode(params).then(result => { this.setData({ showEmbedded: true, base64: result.data }) wx.hideLoading() }).catch(err => { wx.hideLoading() util.showToast(err) }) } })