|
|
|
@ -1,6 +1,7 @@ |
|
|
|
// pages/home/customer-info/index.js
|
|
|
|
import Scene from '../../index/scene' |
|
|
|
import { getCustomerInfo } from "../../../api/saas" |
|
|
|
import { getEmplyeeInfo } from "../../../api/user" |
|
|
|
const util = require('../../../utils/util') |
|
|
|
const event = require('../../../utils/event') |
|
|
|
const qrCode = require('../../../utils/weapp-qrcode') |
|
|
|
@ -11,6 +12,7 @@ Scene({ |
|
|
|
* 页面的初始数据 |
|
|
|
*/ |
|
|
|
data: { |
|
|
|
type: 0, |
|
|
|
id: null, |
|
|
|
userId: null, |
|
|
|
form: null, |
|
|
|
@ -22,7 +24,14 @@ Scene({ |
|
|
|
if(!util.isEmpty(options.id)){ |
|
|
|
this.data.id = options.id |
|
|
|
this.data.userId = options.userId |
|
|
|
this.fetchCustomerInfo() |
|
|
|
if(!util.isEmpty(options.type)){ |
|
|
|
this.data.type = Number(options.type) |
|
|
|
} |
|
|
|
if(this.data.type == 0){ |
|
|
|
this.fetchCustomerInfo() |
|
|
|
} else if(this.data.type == 1){ |
|
|
|
this.fetchEmplyeeInfo() |
|
|
|
} |
|
|
|
} |
|
|
|
event.on('EventMessage', this, this.onEvent) |
|
|
|
}, |
|
|
|
@ -37,7 +46,18 @@ Scene({ |
|
|
|
wx.showLoading({ title: '正在获取', mask: true }) |
|
|
|
getCustomerInfo(this.data.id).then(result => { |
|
|
|
wx.hideLoading() |
|
|
|
this.setData({ form: result.data }) |
|
|
|
this.setData({ form: result.data, type: this.data.type }) |
|
|
|
this.showQrCode(`?mark=ztb_saas&QrCodeRecordId=${this.data.id}` ) |
|
|
|
}).catch(err => { |
|
|
|
wx.hideLoading() |
|
|
|
util.showToast(err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
fetchEmplyeeInfo: function(){ |
|
|
|
wx.showLoading({ title: '正在获取', mask: true }) |
|
|
|
getEmplyeeInfo(this.data.id).then(result => { |
|
|
|
wx.hideLoading() |
|
|
|
this.setData({ form: result.data, type: this.data.type }) |
|
|
|
this.showQrCode(`?mark=ztb_saas&QrCodeRecordId=${this.data.id}` ) |
|
|
|
}).catch(err => { |
|
|
|
wx.hideLoading() |