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. //this.data.form.qrCode=res.result
  72. this.setData({
  73. ['form.enterpriseCode']: res.result
  74. })
  75. },
  76. fail: (res) => {
  77. wx.showToast({
  78. title: '扫描失败请手动输入',
  79. icon: 'none'
  80. })
  81. }
  82. })
  83. },
  84. addEnterprise(e) {
  85. if (isNaN(this.data.form.latitude) || isNaN(this.data.form.longitude)) {
  86. wx.showToast({
  87. title: '请点击获取当前位置',
  88. icon: 'none'
  89. })
  90. return
  91. }
  92. if(this.data.form.mainPersonPhone==null||this.data.form.mainPersonPhone==''){
  93. wx.showToast({
  94. title: '请输入主要负责人电话',
  95. icon:'none'
  96. })
  97. return
  98. }
  99. let obj = new Object()
  100. obj.enterpriseCode = this.data.form.enterpriseCode
  101. obj.latitude = this.data.form.latitude
  102. obj.longitude = this.data.form.longitude
  103. obj.businessName = this.data.form.businessName
  104. obj.orgCode = this.data.form.orgCode
  105. obj.officeAddress = this.data.form.officeAddress
  106. obj.businessAddress = this.data.form.businessAddress
  107. obj.supervisor = this.data.form.supervisor
  108. obj.tradeDept = this.data.form.tradeDept
  109. obj.mainPerson = this.data.form.mainPerson
  110. obj.mainPersonPhone = this.data.form.mainPersonPhone
  111. obj.headSecurity = this.data.form.headSecurity
  112. obj.headSecurityPhone = this.data.form.headSecurityPhone
  113. http.post("/system/AppEnterpriseController/addEnterprise", obj, this.addEnterpriseSuccess)
  114. },
  115. addEnterpriseSuccess(e) {
  116. wx.showToast({
  117. title: e.msg,
  118. icon: "none"
  119. })
  120. if (e.code == 200) {
  121. // wx.navigateTo({
  122. // url: '../qiye/qiye',
  123. // })
  124. wx.navigateBack()
  125. }
  126. },
  127. getLocation() {
  128. let that = this
  129. wx.getLocation({
  130. type: 'wgs84', //返回可以用于wx.openLocation的经纬度
  131. success: function (res) {
  132. that.setData({
  133. ['form.longitude']: res.longitude,
  134. ['form.latitude']: res.latitude
  135. })
  136. },
  137. })
  138. },
  139. /**
  140. * 生命周期函数--监听页面加载
  141. */
  142. onLoad(options) {
  143. },
  144. /**
  145. * 生命周期函数--监听页面初次渲染完成
  146. */
  147. onReady() {
  148. },
  149. /**
  150. * 生命周期函数--监听页面显示
  151. */
  152. onShow() {
  153. },
  154. /**
  155. * 生命周期函数--监听页面隐藏
  156. */
  157. onHide() {
  158. },
  159. /**
  160. * 生命周期函数--监听页面卸载
  161. */
  162. onUnload() {
  163. },
  164. /**
  165. * 页面相关事件处理函数--监听用户下拉动作
  166. */
  167. onPullDownRefresh() {
  168. },
  169. /**
  170. * 页面上拉触底事件的处理函数
  171. */
  172. onReachBottom() {
  173. },
  174. /**
  175. * 用户点击右上角分享
  176. */
  177. onShareAppMessage() {
  178. }
  179. })