You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.4 KiB
52 lines
1.4 KiB
// 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,
|
|
customerName: ''
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
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,
|
|
factoryCustomerName: this.data.form.name
|
|
}
|
|
generateCode(params).then(result => {
|
|
this.setData({ showEmbedded: true, base64: result.data, customerName: this.data.form.name })
|
|
wx.hideLoading()
|
|
}).catch(err => {
|
|
wx.hideLoading()
|
|
util.showToast(err)
|
|
})
|
|
}
|
|
})
|