qiyemore.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. // pages/qiyemore/qiyemore.js
  2. import http from '../../base/httputil'
  3. const app = getApp()
  4. Page({
  5. onLoad() {
  6. // console.log("@@","load")
  7. //this.getLocation()
  8. },
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. host: app.globalData.host,
  14. longitude: Number,
  15. form: {
  16. longitude: Number,
  17. latitude: Number,
  18. businessName: '',
  19. orgCode: '',
  20. enterpriseCode: '',
  21. officeAddress: '',
  22. businessAddress: '',
  23. supervisor: '',
  24. tradeDept: '',
  25. deptId: '',
  26. mainPerson: '',
  27. mainPersonPhone: '',
  28. headSecurity: '',
  29. headSecurityPhone: '',
  30. }
  31. },
  32. //-------------------------------表单数据绑定方法---------------------------------------
  33. get_businessName(e) {
  34. this.data.form.businessName = e.detail.value
  35. },
  36. get_orgCode(e) {
  37. this.data.form.orgCode = e.detail.value
  38. },
  39. get_qrCode(e) {
  40. this.data.form.enterpriseCode = e.detail.value
  41. },
  42. get_officeAddress(e) {
  43. this.data.form.officeAddress = e.detail.value
  44. },
  45. get_businessAddress(e) {
  46. this.data.form.businessAddress = e.detail.value
  47. },
  48. get_supervisor(e) {
  49. this.data.form.supervisor = e.detail.value
  50. },
  51. get_tradeDept(e) {
  52. this.data.form.tradeDept = e.detail.value
  53. },
  54. get_mainPerson(e) {
  55. this.data.form.mainPerson = e.detail.value
  56. },
  57. get_mainPersonPhone(e) {
  58. this.data.form.mainPersonPhone = e.detail.value
  59. },
  60. get_headSecurity(e) {
  61. this.data.form.headSecurity = e.detail.value
  62. },
  63. headSecurityPhone(e) {
  64. this.data.form.headSecurityPhone = e.detail.value
  65. },
  66. //----------------------------------------------------------------------------
  67. saoyisao() {
  68. wx.scanCode({
  69. onlyFromCamera: true,
  70. success: (res) => {
  71. console.log("$$$", res);
  72. //this.data.form.qrCode=res.result
  73. this.setData({
  74. ['form.enterpriseCode']: res.result
  75. })
  76. },
  77. fail: (res) => {
  78. wx.showToast({
  79. title: '扫描失败请手动输入',
  80. icon: 'none'
  81. })
  82. }
  83. })
  84. },
  85. addEnterprise(e) {
  86. console.log("###1", this.data.form.enterpriseCode)
  87. if (isNaN(this.data.form.latitude) || isNaN(this.data.form.longitude)) {
  88. wx.showToast({
  89. title: '请点击获取当前位置',
  90. icon: 'none'
  91. })
  92. return
  93. }
  94. if(this.data.form.mainPersonPhone==null||this.data.form.mainPersonPhone==''){
  95. wx.showToast({
  96. title: '请输入主要负责人电话',
  97. icon:'none'
  98. })
  99. return
  100. }
  101. let obj = new Object()
  102. obj.enterpriseCode = this.data.form.enterpriseCode
  103. obj.latitude = this.data.form.latitude
  104. obj.longitude = this.data.form.longitude
  105. obj.businessName = this.data.form.businessName
  106. obj.orgCode = this.data.form.orgCode
  107. obj.officeAddress = this.data.form.officeAddress
  108. obj.businessAddress = this.data.form.businessAddress
  109. obj.supervisor = this.data.form.supervisor
  110. obj.tradeDept = this.data.form.tradeDept
  111. obj.mainPerson = this.data.form.mainPerson
  112. obj.mainPersonPhone = this.data.form.mainPersonPhone
  113. obj.headSecurity = this.data.form.headSecurity
  114. obj.headSecurityPhone = this.data.form.headSecurityPhone
  115. console.log("@@@@", obj)
  116. http.post("/system/AppEnterpriseController/addEnterprise", obj, this.addEnterpriseSuccess)
  117. },
  118. addEnterpriseSuccess(e) {
  119. wx.showToast({
  120. title: e.msg,
  121. icon: "none"
  122. })
  123. if (e.code == 200) {
  124. // wx.navigateTo({
  125. // url: '../qiye/qiye',
  126. // })
  127. wx.navigateBack()
  128. }
  129. },
  130. getLocation() {
  131. let that = this
  132. wx.getLocation({
  133. type: 'wgs84', //返回可以用于wx.openLocation的经纬度
  134. success: function (res) {
  135. that.setData({
  136. ['form.longitude']: res.longitude,
  137. ['form.latitude']: res.latitude
  138. })
  139. },
  140. })
  141. },
  142. /**
  143. * 生命周期函数--监听页面加载
  144. */
  145. onLoad(options) {
  146. },
  147. /**
  148. * 生命周期函数--监听页面初次渲染完成
  149. */
  150. onReady() {
  151. },
  152. /**
  153. * 生命周期函数--监听页面显示
  154. */
  155. onShow() {
  156. },
  157. /**
  158. * 生命周期函数--监听页面隐藏
  159. */
  160. onHide() {
  161. },
  162. /**
  163. * 生命周期函数--监听页面卸载
  164. */
  165. onUnload() {
  166. },
  167. /**
  168. * 页面相关事件处理函数--监听用户下拉动作
  169. */
  170. onPullDownRefresh() {
  171. },
  172. /**
  173. * 页面上拉触底事件的处理函数
  174. */
  175. onReachBottom() {
  176. },
  177. /**
  178. * 用户点击右上角分享
  179. */
  180. onShareAppMessage() {
  181. }
  182. })