123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- // 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() {
- }
- })
|