// pages/qiyemore/qiyemore.js import http from '../../base/httputil' const app = getApp() Page({ onLoad() { // console.log("@@","load") //this.getLocation() }, /** * 页面的初始数据 */ data: { host: app.globalData.host, longitude: Number, form: { longitude: Number, latitude: Number, businessName: '', orgCode: '', enterpriseCode: '', officeAddress: '', businessAddress: '', supervisor: '', tradeDept: '', deptId: '', mainPerson: '', mainPersonPhone: '', headSecurity: '', headSecurityPhone: '', } }, //-------------------------------表单数据绑定方法--------------------------------------- get_businessName(e) { this.data.form.businessName = e.detail.value }, get_orgCode(e) { this.data.form.orgCode = e.detail.value }, get_qrCode(e) { this.data.form.enterpriseCode = e.detail.value }, get_officeAddress(e) { this.data.form.officeAddress = e.detail.value }, get_businessAddress(e) { this.data.form.businessAddress = e.detail.value }, get_supervisor(e) { this.data.form.supervisor = e.detail.value }, get_tradeDept(e) { this.data.form.tradeDept = e.detail.value }, get_mainPerson(e) { this.data.form.mainPerson = e.detail.value }, get_mainPersonPhone(e) { this.data.form.mainPersonPhone = e.detail.value }, get_headSecurity(e) { this.data.form.headSecurity = e.detail.value }, headSecurityPhone(e) { this.data.form.headSecurityPhone = e.detail.value }, //---------------------------------------------------------------------------- saoyisao() { wx.scanCode({ onlyFromCamera: true, success: (res) => { //this.data.form.qrCode=res.result this.setData({ ['form.enterpriseCode']: res.result }) }, fail: (res) => { wx.showToast({ title: '扫描失败请手动输入', icon: 'none' }) } }) }, addEnterprise(e) { if (isNaN(this.data.form.latitude) || isNaN(this.data.form.longitude)) { wx.showToast({ title: '请点击获取当前位置', icon: 'none' }) return } if(this.data.form.businessName==null||this.data.form.businessName==''){ wx.showToast({ title: '请输入企业名称', icon:'none' }) return } if(this.data.form.enterpriseCode==null||this.data.form.enterpriseCode==''){ wx.showToast({ title: '请输入企业编码', icon:'none' }) return } if(this.data.form.orgCode==null||this.data.form.orgCode==''){ wx.showToast({ title: '请输入机构代码证号', icon:'none' }) return } if(this.data.form.officeAddress==null||this.data.form.officeAddress==''){ wx.showToast({ title: '请输入办公地址', icon:'none' }) return } if(this.data.form.mainPerson==null||this.data.form.mainPerson==''){ wx.showToast({ title: '请输入主要负责人姓名', icon:'none' }) return } if(this.data.form.mainPersonPhone==null||this.data.form.mainPersonPhone==''){ wx.showToast({ title: '请输入主要负责人电话', icon:'none' }) return } let obj = new Object() obj.enterpriseCode = this.data.form.enterpriseCode obj.latitude = this.data.form.latitude obj.longitude = this.data.form.longitude obj.businessName = this.data.form.businessName obj.orgCode = this.data.form.orgCode obj.officeAddress = this.data.form.officeAddress obj.businessAddress = this.data.form.businessAddress obj.supervisor = this.data.form.supervisor obj.tradeDept = this.data.form.tradeDept obj.mainPerson = this.data.form.mainPerson obj.mainPersonPhone = this.data.form.mainPersonPhone obj.headSecurity = this.data.form.headSecurity obj.headSecurityPhone = this.data.form.headSecurityPhone http.post("/system/AppEnterpriseController/addEnterprise", obj, this.addEnterpriseSuccess) }, addEnterpriseSuccess(e) { wx.showToast({ title: e.msg, icon: "none" }) if (e.code == 200) { // wx.navigateTo({ // url: '../qiye/qiye', // }) wx.navigateBack() } }, getLocation() { let that = this wx.getLocation({ type: 'wgs84', //返回可以用于wx.openLocation的经纬度 success: function (res) { that.setData({ ['form.longitude']: res.longitude, ['form.latitude']: res.latitude }) }, }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })