1020 lines
25 KiB
JavaScript
1020 lines
25 KiB
JavaScript
// pages/signUpPage/signUpPage.js
|
|
import signUpApi from '../../assets/js/http/signUp'
|
|
import MeetingApi from '../../assets/js/http/meetingApi'
|
|
// 引入对发票信息 校验的方法
|
|
let confirmInvoiceModalBehavior = require('../../behavior/confirmInvoiceModal.js')
|
|
import {
|
|
phoneReg,
|
|
postcode,
|
|
compareDate,
|
|
dutyCode
|
|
} from '../../utils/validate'
|
|
import {
|
|
InvoiceTypeEnums
|
|
} from '../../assets/js/Enums/common.js'
|
|
|
|
Page({
|
|
behaviors: [confirmInvoiceModalBehavior],
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
// 参会身份数组
|
|
identifyList: [{
|
|
value: '2',
|
|
name: '参会人',
|
|
disabled: false
|
|
},
|
|
{
|
|
value: '1',
|
|
name: '嘉宾',
|
|
disabled: false
|
|
},
|
|
{
|
|
value: '3',
|
|
name: '内部企业',
|
|
disabled: true
|
|
},
|
|
],
|
|
// 缴费方式
|
|
paymentMethodList: [{
|
|
value: '1',
|
|
name: '汇款'
|
|
},
|
|
{
|
|
value: '2',
|
|
name: '现场缴费(仅支持扫码支付)'
|
|
},
|
|
{
|
|
value: '3',
|
|
name: '打包'
|
|
},
|
|
],
|
|
|
|
// 是否需要发票
|
|
needInvoiceList: [{
|
|
value: '0',
|
|
name: '不需要'
|
|
},
|
|
{
|
|
value: '1',
|
|
name: '增值税普通发票'
|
|
},
|
|
{
|
|
value: '2',
|
|
name: '增值税专用发票'
|
|
},
|
|
],
|
|
// 发票项目
|
|
invoiceProjectList: [{
|
|
value: '1',
|
|
name: '会议费'
|
|
},
|
|
{
|
|
value: '2',
|
|
name: '培训费'
|
|
},
|
|
],
|
|
// 是否住酒店
|
|
needCheckInHotel: [{
|
|
value: '1',
|
|
name: '是'
|
|
},
|
|
{
|
|
value: '0',
|
|
name: '否'
|
|
},
|
|
],
|
|
// 选中的参会身份 默认参会人
|
|
selectedIdentity: '2',
|
|
// 是否选择发票的选中的索引 默认需要
|
|
index: -1,
|
|
// 发票项目选择的索引
|
|
invoiceProjectIndex: -1,
|
|
paymentMethod: '1',
|
|
// 抵达时间
|
|
arrivalTime: '请选择抵达时间',
|
|
// 离开时间
|
|
departureTime: '请选择离开时间',
|
|
// 选中的参会单位
|
|
selectedCompany: {},
|
|
// 选中的联系人
|
|
selectedPerson: {},
|
|
// 选中的邮寄联系人
|
|
selectedPostPerson: {},
|
|
// 选中的会议
|
|
selectedMeeting: {},
|
|
// 会议id
|
|
meetingId: '',
|
|
// 是否正确填写信息
|
|
flag: false,
|
|
// 是否是首页消息进来的
|
|
indexMsgBool: false,
|
|
// 首页消息
|
|
indexMsg: '',
|
|
// 扫码报名的 需要调用无限制接口
|
|
nolimitBool: false,
|
|
// 会议费用
|
|
meetingCost: '',
|
|
// 备注信息
|
|
remark: '',
|
|
},
|
|
// 是否需要发票的选择
|
|
needInvoiceChange(e) {
|
|
this.setData({
|
|
index: e.detail.value
|
|
})
|
|
},
|
|
// 抵达时间选择
|
|
bindDateChangeArriveTime(e) {
|
|
this.setData({
|
|
arrivalTime: e.detail.value
|
|
})
|
|
},
|
|
// 离开时间选择
|
|
bindDateChangeLeaveTime(e) {
|
|
this.setData({
|
|
departureTime: e.detail.value
|
|
})
|
|
},
|
|
// 内部企业是否禁用 只有参会单位是内部企业才能选 否则禁用内部企业
|
|
setIdentityDisabled(bool) {
|
|
const identifyLiseSelect = [{
|
|
value: '2',
|
|
name: '参会人',
|
|
disabled: false
|
|
},
|
|
{
|
|
value: '1',
|
|
name: '嘉宾',
|
|
disabled: false
|
|
},
|
|
{
|
|
value: '3',
|
|
name: '内部企业',
|
|
disabled: false
|
|
},
|
|
]
|
|
const identifyLiseSelectDisabled = [{
|
|
value: '2',
|
|
name: '参会人',
|
|
disabled: false
|
|
},
|
|
{
|
|
value: '1',
|
|
name: '嘉宾',
|
|
disabled: false
|
|
},
|
|
{
|
|
value: '3',
|
|
name: '内部企业',
|
|
disabled: true
|
|
},
|
|
]
|
|
if (bool) {
|
|
// bool为真 说明是内部企业可以选择内部企业
|
|
this.setData({
|
|
'identifyList': identifyLiseSelect
|
|
})
|
|
|
|
} else {
|
|
// 否则不能选中
|
|
console.log('不是内部i企业')
|
|
this.setData({
|
|
'identifyList': identifyLiseSelectDisabled
|
|
})
|
|
}
|
|
},
|
|
// 选择参会身份
|
|
changeIdentity(e) {
|
|
// 如果没有选择参会单位 让先选择参会
|
|
const that = this
|
|
this.setData({
|
|
selectedIdentity: e.detail.value
|
|
})
|
|
// 参会身份选择嘉宾和内部企业 会议费用为 0
|
|
if (e.detail.value === '2') {
|
|
// 标协会议需要判断选中的企业是否是标协成员
|
|
if (this.data.selectedMeeting.meetingType === '2') {
|
|
signUpApi.validateStandard({
|
|
companyName: that.data.selectedCompany.companyName
|
|
}).then(result => {
|
|
if (result.result) {
|
|
that.setData({
|
|
meetingCost: that.data.selectedMeeting.meetingCostsVip
|
|
})
|
|
} else {
|
|
that.setData({
|
|
meetingCost: that.data.selectedMeeting.meetingCosts
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
this.setData({
|
|
meetingCost: that.data.selectedMeeting.meetingCosts
|
|
})
|
|
}
|
|
|
|
} else {
|
|
this.setData({
|
|
meetingCost: '0.00'
|
|
})
|
|
}
|
|
},
|
|
// 缴费方式的选择
|
|
paymentMethodRadioChange(e) {
|
|
this.setData({
|
|
paymentMethod: e.detail.value
|
|
})
|
|
},
|
|
// 确定
|
|
formSubmit(e) {
|
|
const formData = Object.assign({}, e.detail.value)
|
|
|
|
// 会议id
|
|
if (this.data.selectedMeeting.id) {
|
|
formData.meetingId = this.data.selectedMeeting.id
|
|
} else {
|
|
wx.getStorage({
|
|
key: "meetingId",
|
|
success(res) {
|
|
formData.meetingId = res.data
|
|
}
|
|
})
|
|
}
|
|
// 参会人id
|
|
formData.companyContactId = this.data.selectedPerson.id
|
|
// 邮寄联系人id
|
|
formData.postContactId = this.data.selectedPostPerson.id
|
|
// 参会企业id
|
|
formData.companyId = this.data.selectedCompany.id
|
|
// 会议类型
|
|
formData.meetingType = this.data.selectedMeeting.meetingType
|
|
console.log(formData);
|
|
if (this.data.flag) {
|
|
wx.showToast({
|
|
title: '信息输入有误',
|
|
icon: 'error',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
|
|
if (!formData.companyId) {
|
|
wx.showToast({
|
|
title: '请选择参会单位',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
if (!formData.companyContactId) {
|
|
wx.showToast({
|
|
title: '请选择参会人',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
// 参会身份验证
|
|
if (formData.identity === '') {
|
|
wx.showToast({
|
|
title: '请选择参会身份',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
// 手机号验证
|
|
if (formData.phone === '' || formData.phone === undefined) {
|
|
wx.showToast({
|
|
title: '请输入手机号',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
// 缴费方式
|
|
if (formData.payMode === '') {
|
|
wx.showToast({
|
|
title: '请选择缴费方式',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
// 是否需要发票
|
|
if (formData.needInvoice === -1) {
|
|
wx.showToast({
|
|
title: '请选择是否需要发票',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
// 20230720 新增需要判断当需要发票时,所有的发票信息是否填写
|
|
if(Number(formData.needInvoice)){
|
|
if (!formData.dutyCode) {
|
|
wx.showToast({
|
|
title: '请输入信用代码',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
// 验证企业信用代码是否正确
|
|
if(!dutyCode(formData.dutyCode)) {
|
|
wx.showToast({
|
|
title: '请输入正确的信用代码',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
if(Number(formData.needInvoice) === InvoiceTypeEnums.special.index) {
|
|
if (!formData.companyAddress) {
|
|
wx.showToast({
|
|
title: '请输入公司地址',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
if (!formData.companyPhone) {
|
|
wx.showToast({
|
|
title: '请输入公司电话',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
if (!formData.openingBank) {
|
|
wx.showToast({
|
|
title: '请输入开户行',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
if (!formData.bankAccount) {
|
|
wx.showToast({
|
|
title: '请输入银行账号',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
if (!formData.linkBankNumber) {
|
|
wx.showToast({
|
|
title: '请输入联行号',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
}
|
|
if (formData.invoiceProject === undefined || formData.invoiceProject === -1) {
|
|
wx.showToast({
|
|
title: '请选择发票项目',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
formData.invoiceProject = this.data.invoiceProjectList[formData.invoiceProject].value
|
|
}
|
|
// 邮寄联系人
|
|
if (this.data.selectedPostPerson.id && formData.postContactId === undefined) {
|
|
wx.showToast({
|
|
title: '请选择邮寄联系人',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
// 邮寄地址
|
|
if (formData.postContactAddress === '') {
|
|
wx.showToast({
|
|
title: '请输入邮寄地址',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
// 邮编
|
|
if (formData.postCode === '') {
|
|
wx.showToast({
|
|
title: '请输入邮编',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
// 校验时间
|
|
if (formData.arrivalTime && formData.departureTime) {
|
|
let flag = compareDate(formData.arrivalTime, formData.departureTime)
|
|
if (flag) {
|
|
// 抵达时间大于离开时间
|
|
wx.showToast({
|
|
title: '抵达时间不能大于离开时间',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
}
|
|
|
|
let callback = () => {
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
mask: true
|
|
})
|
|
let func
|
|
let lastPage // 上一个调换的页面,用于记录编辑成功后返回哪个页面
|
|
const isEdit = this.isEdit
|
|
if(isEdit) {
|
|
func = MeetingApi.editContactsInfo
|
|
formData.id = this.model.id // 编辑参会人的信息
|
|
lastPage = this.lastPage
|
|
} else {
|
|
func = signUpApi.signUpMeeting
|
|
}
|
|
func(formData).then(res => {
|
|
if (res.success) {
|
|
wx.hideLoading({})
|
|
let message = isEdit ? '编辑成功' : '报名成功'
|
|
wx.showToast({
|
|
title: message,
|
|
icon: 'loading',
|
|
duration: 1500
|
|
})
|
|
// 成功 清除缓存 跳转报名成功页面
|
|
wx.removeStorage({
|
|
key: 'selectedCompany',
|
|
})
|
|
wx.removeStorage({
|
|
key: 'meetingId',
|
|
})
|
|
wx.removeStorage({
|
|
key: 'currentMeetingInfo',
|
|
success() {
|
|
// 非编辑页面跳转到下一页
|
|
if(!isEdit) {
|
|
// 跳转报名成功页面
|
|
if (!res.result) {
|
|
wx.navigateTo({
|
|
url: `../signUpSuccess/signUpSuccess?audit=${res.result}`,
|
|
})
|
|
} else {
|
|
wx.navigateTo({
|
|
url: `../signUpSuccess/signUpSuccess`,
|
|
})
|
|
}
|
|
} else {
|
|
// 编辑页面跳转到会议列表页
|
|
wx.navigateTo({
|
|
url: lastPage,
|
|
})
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: res.message,
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
}
|
|
}).catch(e => {
|
|
wx.showToast({
|
|
title: '操作失败',
|
|
icon: 'error',
|
|
duration: 2000
|
|
})
|
|
})
|
|
}
|
|
// 如果不需要发票
|
|
if(!Number(formData.needInvoice)) {
|
|
callback && callback()
|
|
return
|
|
}
|
|
|
|
//显示 校验发票信息的弹框
|
|
this.showConfirmModal(formData, callback)
|
|
|
|
|
|
},
|
|
// 选择参会单位
|
|
selectCompany() {
|
|
|
|
let flag
|
|
wx.getStorage({
|
|
key: 'companyDisabled',
|
|
success(res) {
|
|
if (res.data) {
|
|
flag = res.data
|
|
}
|
|
}
|
|
})
|
|
|
|
if (flag) {
|
|
return
|
|
}
|
|
if (this.data.nolimitBool) {
|
|
wx.navigateTo({
|
|
url: `../companyList/companyList?nolimit=nolimt`,
|
|
})
|
|
} else {
|
|
wx.navigateTo({
|
|
url: `../companyList/companyList?nolimit=nolimt`,
|
|
})
|
|
}
|
|
},
|
|
// 选择参会人
|
|
selectPerson(e) {
|
|
const that = this
|
|
if (!!this.data.selectedCompany.id) {
|
|
wx.navigateTo({
|
|
url: `../personList/personList?companyId=${this.data.selectedCompany.id}&selectType=${e.currentTarget.dataset.selecttype}&nolimit=${that.data.nolimitBool}`,
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: '请先选择参会单位',
|
|
icon: "none",
|
|
duration: 800,
|
|
});
|
|
}
|
|
},
|
|
// 信用代码验证
|
|
validateDutyCode(e) {
|
|
let value = e.detail.value
|
|
let {
|
|
message,
|
|
errmsg
|
|
} = e.currentTarget.dataset
|
|
if (value === '' || value === undefined) {
|
|
wx.showToast({
|
|
title: message,
|
|
icon: 'none',
|
|
duration: 800
|
|
})
|
|
// this.setData({
|
|
// flag: true
|
|
// })
|
|
return
|
|
} else if (dutyCode(value)) {
|
|
// this.setData({
|
|
// flag: false
|
|
// })
|
|
} else {
|
|
wx.showToast({
|
|
title: errmsg,
|
|
icon: 'none',
|
|
duration: 800
|
|
})
|
|
// this.setData({
|
|
// flag: true
|
|
// })
|
|
}
|
|
},
|
|
// 发票项目变化的时候触发的方法
|
|
invoiceProjectChange(e) {
|
|
this.setData({
|
|
invoiceProjectIndex: e.detail.value
|
|
})
|
|
},
|
|
// 根据会议id查询会议信息
|
|
queryMeetingInfo(id) {
|
|
MeetingApi.meetingDetail({
|
|
id: id
|
|
}).then(res => {
|
|
if (res.success) {
|
|
this.setData({
|
|
selectedMeeting: res.result,
|
|
meetingCost: res.result.meetingCosts
|
|
})
|
|
// 编辑的时候判断是否是标协会员,费用是否需要修改
|
|
if(this.isEdit) {
|
|
this.judgeMemberCompany(this, res.result)
|
|
}
|
|
// 存储会议信息
|
|
wx.setStorage({
|
|
key: 'currentMeetingInfo',
|
|
data: res.result
|
|
})
|
|
}
|
|
}).catch(() => {
|
|
wx.showToast({
|
|
title: '加载失败',
|
|
icon: 'none',
|
|
duration: 1000
|
|
})
|
|
})
|
|
},
|
|
/*
|
|
* 编辑
|
|
* */
|
|
async edit(record){
|
|
this.model = Object.assign({}, record)
|
|
// 选中的身份
|
|
const selectedIdentity = this.model.identity + ''
|
|
// 参会身份选中状态的处理
|
|
this.data.identifyList.map(tt => {
|
|
if (tt.value === selectedIdentity) {
|
|
tt.checked = true
|
|
}
|
|
})
|
|
// 是否选择发票的选中的索引 默认需要
|
|
const index = this.data.needInvoiceList.findIndex(e => e.value === (this.model.needInvoice + '')) + ''
|
|
// 缴费方式
|
|
const paymentMethod = this.model.payMode
|
|
// 缴费方式选中状态的处理
|
|
this.data.paymentMethodList.map(tt => {
|
|
if (tt.value === paymentMethod + '') {
|
|
tt.checked = true
|
|
}
|
|
})
|
|
// 通过接口获取全部的企业信息
|
|
let companyInfo = await this.queryCompanyInfoById(this.model.companyId)
|
|
// 然后和PC端一样对比字段的值,将没有的初始化复制
|
|
let invoiceKeys = ['dutyCode', 'companyAddress', 'companyPhone', 'openingBank', 'bankAccount', 'linkBankNumber']
|
|
let invoiceInfo = {}
|
|
invoiceKeys.map(key => {
|
|
if(this.model[key]) {
|
|
invoiceInfo[key] = this.model[key]
|
|
}
|
|
})
|
|
// 选中的参会单位
|
|
const selectedCompany = Object.assign({}, companyInfo, {
|
|
id: this.model.companyId,
|
|
companyName: this.model.companyName,
|
|
}, invoiceInfo)
|
|
|
|
// const selectedCompany = {
|
|
// id:this.model.companyId,
|
|
// companyName:this.model.companyName,
|
|
// // 写入发票的信息,因为需要回显
|
|
// dutyCode:this.model.dutyCode, // 信用代码
|
|
// companyAddress:this.model.companyAddress, // 公司地址
|
|
// companyPhone:this.model.companyPhone, // 公司电话
|
|
// openingBank:this.model.openingBank, // 开户行
|
|
// bankAccount:this.model.bankAccount, // 银行账号
|
|
// linkBankNumber:this.model.linkBankNumber // 联行号
|
|
// }
|
|
const selectedPerson = {
|
|
id:this.model.companyContactTemporaryId,
|
|
name:this.model.companyContactName
|
|
}
|
|
// 发票项目选择的索引
|
|
const invoiceProjectIndex = this.data.invoiceProjectList.findIndex(e => e.value === (this.model.invoiceProject + ''))
|
|
// 回显邮寄联系人
|
|
const selectedPostPerson = {
|
|
id: this.model.postContactId,
|
|
name: this.model.postContactName,
|
|
contactAddress: this.model.postContactAddress, // 邮寄地址
|
|
postalCode: this.model.postCode, // 邮编
|
|
}
|
|
|
|
this.setData({
|
|
selectedCompany,
|
|
selectedPerson,
|
|
phone: this.model.phone,
|
|
selectedIdentity, // 参会身份
|
|
identifyList: this.data.identifyList, // 参会身份选中
|
|
paymentMethod, // 缴费方式
|
|
paymentMethodList: this.data.paymentMethodList, // 缴费方式信息选中
|
|
index, // 是否需要发票
|
|
invoiceProjectIndex, // 发票项目
|
|
selectedPostPerson, // 邮寄联系人信息
|
|
remark: this.model.remark // 备注
|
|
})
|
|
},
|
|
// 通过id获取企业的信息
|
|
queryCompanyInfoById(id) {
|
|
return new Promise(resolve => {
|
|
let result = {}
|
|
MeetingApi.queryCompanyInfoById({id}).then(callRes => {
|
|
if(callRes.success) {
|
|
result = callRes.result || {}
|
|
}
|
|
}).finally(() => {
|
|
resolve(result)
|
|
})
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: async function (options) {
|
|
console.log(options, "------options-------")
|
|
// options = {
|
|
// id: "1682018325751480322",
|
|
// meetingId: "1680850121742204930",
|
|
// meetingType: 1,
|
|
// page: 'meeting',
|
|
// ope: 'edit'
|
|
// }
|
|
if (options.type) {
|
|
this.setData({
|
|
indexMsg: options.type,
|
|
})
|
|
}
|
|
if (options.nolimit) {
|
|
this.setData({
|
|
nolimitBool: true
|
|
})
|
|
}
|
|
// 初始化一些信息和页面上的判断 为了不显示相应的数据
|
|
this.setData({
|
|
selectedIdentity: 0, // 选中的参会身份
|
|
paymentMethod: 0, // 缴费方式
|
|
pageTitle: options.id ? '编辑报名信息' : '会议报名'
|
|
})
|
|
if(options.id){
|
|
this.isEdit = options.ope === 'edit'
|
|
this.lastPage = `../${options.page}/${options.page}`
|
|
// 对上一个页面的参数进行处理
|
|
this.lastOptions = options.options && JSON.parse(options.options) || {}
|
|
let str = ''
|
|
Object.keys(this.lastOptions).forEach((tt, i) => {
|
|
if( i > 0) {
|
|
str += `&${tt}=${this.lastOptions[tt]}`
|
|
} else {
|
|
str += `?${tt}=${this.lastOptions[tt]}`
|
|
}
|
|
})
|
|
this.lastPage += str
|
|
// 通过id获取参会人信息
|
|
MeetingApi.queryPersongInfoById({id: options.id}).then(res => {
|
|
if(res.success){
|
|
this.edit(res.result)
|
|
}
|
|
})
|
|
}
|
|
// this.queryMeetingInfo('1455359606691979265')
|
|
if (options.meetingId) {
|
|
await this.queryMeetingInfo(options.meetingId)
|
|
this.setData({
|
|
meetingId: options.meetingId
|
|
})
|
|
wx.setStorage({
|
|
key: 'meetingId',
|
|
data: options.meetingId
|
|
})
|
|
}
|
|
const that = this
|
|
// 是否是从首页消息进来的报名
|
|
if (options.type === 'indexMsg') {
|
|
this.setData({
|
|
indexMsgBool: true
|
|
})
|
|
|
|
// 默认填写个人信息
|
|
// 从缓存中拿个人信息
|
|
// TODO 好像拿不到企业的其他信息
|
|
wx.getStorage({
|
|
key: 'userInfo',
|
|
async success(res) {
|
|
// 通过接口获取全部的企业信息
|
|
let result = await that.queryCompanyInfoById(res.data.companyId)
|
|
let selectedCompany = {
|
|
companyName: result.companyName,
|
|
dutyCode: result.dutyCode,
|
|
companyAddress: result.companyAddress,
|
|
companyPhone: result.companyPhone,
|
|
openingBank: result.openingBank,
|
|
bankAccount: result.bankAccount,
|
|
linkBankNumber: result.linkBankNumber,
|
|
id: res.data.companyId
|
|
}
|
|
that.setData({
|
|
selectedCompany
|
|
})
|
|
|
|
that.setData({
|
|
// 'selectedCompany.companyName': res.data.companyName,
|
|
// 'selectedCompany.id': res.data.companyId,
|
|
'selectedPerson.name': res.data.name,
|
|
'selectedPerson.id': res.data.id,
|
|
phone: res.data.phone,
|
|
'selectedPostPerson.id': res.data.id,
|
|
'selectedPostPerson.name': res.data.name,
|
|
'selectedPostPerson.contactAddress': res.data.contactAddress,
|
|
'selectedPostPerson.postalCode': res.data.postalCode,
|
|
})
|
|
}
|
|
})
|
|
|
|
}
|
|
},
|
|
// 手机号验证
|
|
validatePhone(e) {
|
|
let value = e.detail.value
|
|
let {
|
|
message,
|
|
errmsg
|
|
} = e.currentTarget.dataset
|
|
if (value === '' || value === undefined) {
|
|
wx.showToast({
|
|
title: message,
|
|
icon: 'none',
|
|
duration: 800
|
|
})
|
|
this.setData({
|
|
flag: true
|
|
})
|
|
return
|
|
} else if (phoneReg(value)) {
|
|
this.setData({
|
|
flag: false
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: errmsg,
|
|
icon: 'none',
|
|
duration: 800
|
|
})
|
|
this.setData({
|
|
flag: true
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
// 邮编验证
|
|
validatePostCode(e) {
|
|
let value = e.detail.value
|
|
let {
|
|
message,
|
|
errmsg
|
|
} = e.currentTarget.dataset
|
|
if (value === '' || value === undefined) {
|
|
wx.showToast({
|
|
title: message,
|
|
icon: 'none',
|
|
duration: 800
|
|
})
|
|
this.setData({
|
|
flag: true
|
|
})
|
|
return
|
|
} else if (postcode(value)) {
|
|
this.setData({
|
|
flag: false
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: errmsg,
|
|
icon: 'none',
|
|
duration: 800
|
|
})
|
|
this.setData({
|
|
flag: true
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
/**
|
|
* 判断是否是标协会员的单位 进行费用的重置
|
|
* @param that--原方法里面就是this实例
|
|
* @param meetingObj -- 原方法是获取的currentMeetingInfo信息
|
|
*/
|
|
judgeMemberCompany(that, meetingObj) {
|
|
// 标协会议需要判断单位是否是会员单位
|
|
if (that.data.selectedCompany.companyName && meetingObj.meetingType + '' === '2') {
|
|
signUpApi.validateStandard({
|
|
companyName: that.data.selectedCompany.companyName
|
|
}).then(result => {
|
|
if (result.result) {
|
|
that.setData({
|
|
meetingCost: meetingObj.meetingCostsVip
|
|
})
|
|
} else {
|
|
that.setData({
|
|
meetingCost: meetingObj.meetingCosts
|
|
})
|
|
}
|
|
}).finally(() => {
|
|
if (that.data.selectedIdentity) {
|
|
that.changeIdentity({
|
|
detail: {
|
|
value: that.data.selectedIdentity
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
console.log(this.data.selectedMeeting, 'this.selectedMeeting');
|
|
const that = this
|
|
// 是否是从首页消息进来的报名
|
|
if (this.data.type === 'indexMsg') {
|
|
// 默认填写个人信息
|
|
// 从缓存中拿个人信息
|
|
wx.getStorage({
|
|
key: 'userInfo',
|
|
success(res) {
|
|
that.setData({
|
|
'selectedCompany.companyName': res.data.companyName,
|
|
'selectedPerson.name': res.data.name,
|
|
'selectedCompany.id': res.data.companyId,
|
|
phone: res.data.phone,
|
|
})
|
|
}
|
|
})
|
|
|
|
}
|
|
|
|
// 从缓存中拿选中的企业
|
|
|
|
wx.getStorage({
|
|
key: 'selectedCompany',
|
|
success(res) {
|
|
that.setData({
|
|
selectedCompany: JSON.parse(res.data)
|
|
})
|
|
}
|
|
})
|
|
// 从缓存中拿选中的联系人
|
|
wx.getStorage({
|
|
key: 'selectedPerson',
|
|
success(res) {
|
|
that.setData({
|
|
selectedPerson: res.data
|
|
})
|
|
}
|
|
})
|
|
|
|
// 从缓存中拿选中的邮寄联系人
|
|
wx.getStorage({
|
|
key: 'selectedPostPerson',
|
|
success(res) {
|
|
that.setData({
|
|
selectedPostPerson: res.data
|
|
})
|
|
}
|
|
})
|
|
// 从缓存中拿选中的会议的信息
|
|
|
|
wx.getStorage({
|
|
key: 'currentMeetingInfo',
|
|
success(res) {
|
|
that.setData({
|
|
selectedMeeting: res.data
|
|
})
|
|
that.judgeMemberCompany(that, res.data)
|
|
}
|
|
})
|
|
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
})
|