123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- // pages/invitation/verify/index.js
- const app = getApp();
- const api = app.api;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- statusOptions: [
- {id: '0', value: '藏家 Collector'},
- {id: '1', value: '艺术行业 Art Professional'},
- {id: '2', value: '院校师生 Academic'},
- {id: '3', value: '媒体 Media'},
- {id: '4', value: '合作方 Partner'},
- {id: '5', value: '其他 Other '}
- ],
- idTypeOptions: [
- {id: '0', value: '身份证 ID Card'},
- {id: '1', value: '护照 Passport'},
- {id: '2', value: '回乡证 Home Return Certificate'},
- {id: '3', value: '台胞证 MTP'}
- ],
- countryOptions: [
- {id: '0', value: '中国 China'},
- {id: '1', value: '外籍 Foreigners'}
- ],
- genderOptions: [
- {id: '0', value: '男 Male'},
- {id: '1', value: '女 Female'},
- {id: '2', value: '其他 Other'}
- ],
- dataForm: {
- id: '',
- status: '0',
- statusOther: '',
- realName: '',
- idType: '0',
- idNumber: '',
- country: '0',
- liveCity: ['', '', ''],
- liveCityNotChina: '',
- gender: '0',
- emailAddress: '',
- company: '',
- position: ''
- }
- },
- /**
- * 查询客人信息
- */
- getGuest(id) {
- const self = this;
- app.post(api.InvitationGetId, {id: id}).then(response => {
- if(response.success) {
- self.setData({
- ['dataForm.id']: response.data.id,
- ['dataForm.status']: response.data.roles,
- ['dataForm.statusOther']: response.data.roleOther,
- ['dataForm.realName']: response.data.name,
- ['dataForm.idType']: response.data.types,
- ['dataForm.idNumber']: response.data.nums,
- ['dataForm.country']: response.data.country,
- ['dataForm.liveCity']: response.data.country === 0 ? [response.data.province, response.data.city, response.data.district] : [],
- ['dataForm.liveCityNotChina']: response.data.country === 1 ? response.data.states : '',
- ['dataForm.gender']: response.data.gender + '',
- ['dataForm.emailAddress']: response.data.mail,
- ['dataForm.company']: response.data.company,
- ['dataForm.position']: response.data.position,
- ['dataForm.signTime']: response.data.signTime
- })
- }
- }).catch(() => {
- wx.showToast({
- title: '未查询到登记信息',
- complete: function() {
- setTimeout(() => {
- wx.navigateBack({
- delta: 0,
- })
- }, 1500)
- }
- })
- })
- },
- /**
- * 核销
- */
- guestSign: function() {
- const self = this
- app.post(api.InvitationVerification, {id: self.data.dataForm.id}).then(response => {
- if (response.success) {
- wx.showToast({
- title: '核验成功',
- mask: true,
- complete: function() {
- setTimeout(() => {
- wx.navigateBack({
- delta: 0,
- })
- }, 1500)
- }
- })
- }
- }).catch(() => {
- wx.showModal({
- title: '核验失败',
- showCancel: false,
- content: '未查询到登记信息',
- success: function(res) {
- if(res.confirm) {
- wx.navigateBack({
- delta: 0,
- })
- }
- }
- });
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- const id = options.id;
- const self = this
- self.getGuest(id)
- wx.setNavigationBarTitle({
- title: '邀请码核验',
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- })
|