qiyemore.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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.businessName==null||this.data.form.businessName==''){
  93. wx.showToast({
  94. title: '请输入企业名称',
  95. icon:'none'
  96. })
  97. return
  98. }
  99. if(this.data.form.enterpriseCode==null||this.data.form.enterpriseCode==''){
  100. wx.showToast({
  101. title: '请输入企业编码',
  102. icon:'none'
  103. })
  104. return
  105. }
  106. if(this.data.form.orgCode==null||this.data.form.orgCode==''){
  107. wx.showToast({
  108. title: '请输入机构代码证号',
  109. icon:'none'
  110. })
  111. return
  112. }
  113. if(this.data.form.officeAddress==null||this.data.form.officeAddress==''){
  114. wx.showToast({
  115. title: '请输入办公地址',
  116. icon:'none'
  117. })
  118. return
  119. }
  120. if(this.data.form.mainPerson==null||this.data.form.mainPerson==''){
  121. wx.showToast({
  122. title: '请输入主要负责人姓名',
  123. icon:'none'
  124. })
  125. return
  126. }
  127. if(this.data.form.mainPersonPhone==null||this.data.form.mainPersonPhone==''){
  128. wx.showToast({
  129. title: '请输入主要负责人电话',
  130. icon:'none'
  131. })
  132. return
  133. }
  134. let obj = new Object()
  135. obj.enterpriseCode = this.data.form.enterpriseCode
  136. obj.latitude = this.data.form.latitude
  137. obj.longitude = this.data.form.longitude
  138. obj.businessName = this.data.form.businessName
  139. obj.orgCode = this.data.form.orgCode
  140. obj.officeAddress = this.data.form.officeAddress
  141. obj.businessAddress = this.data.form.businessAddress
  142. obj.supervisor = this.data.form.supervisor
  143. obj.tradeDept = this.data.form.tradeDept
  144. obj.mainPerson = this.data.form.mainPerson
  145. obj.mainPersonPhone = this.data.form.mainPersonPhone
  146. obj.headSecurity = this.data.form.headSecurity
  147. obj.headSecurityPhone = this.data.form.headSecurityPhone
  148. http.post("/system/AppEnterpriseController/addEnterprise", obj, this.addEnterpriseSuccess)
  149. },
  150. addEnterpriseSuccess(e) {
  151. wx.showToast({
  152. title: e.msg,
  153. icon: "none"
  154. })
  155. if (e.code == 200) {
  156. // wx.navigateTo({
  157. // url: '../qiye/qiye',
  158. // })
  159. wx.navigateBack()
  160. }
  161. },
  162. getLocation() {
  163. let that = this
  164. wx.getLocation({
  165. type: 'wgs84', //返回可以用于wx.openLocation的经纬度
  166. success: function (res) {
  167. that.setData({
  168. ['form.longitude']: res.longitude,
  169. ['form.latitude']: res.latitude
  170. })
  171. },
  172. })
  173. },
  174. /**
  175. * 生命周期函数--监听页面加载
  176. */
  177. onLoad(options) {
  178. },
  179. /**
  180. * 生命周期函数--监听页面初次渲染完成
  181. */
  182. onReady() {
  183. },
  184. /**
  185. * 生命周期函数--监听页面显示
  186. */
  187. onShow() {
  188. },
  189. /**
  190. * 生命周期函数--监听页面隐藏
  191. */
  192. onHide() {
  193. },
  194. /**
  195. * 生命周期函数--监听页面卸载
  196. */
  197. onUnload() {
  198. },
  199. /**
  200. * 页面相关事件处理函数--监听用户下拉动作
  201. */
  202. onPullDownRefresh() {
  203. },
  204. /**
  205. * 页面上拉触底事件的处理函数
  206. */
  207. onReachBottom() {
  208. },
  209. /**
  210. * 用户点击右上角分享
  211. */
  212. onShareAppMessage() {
  213. }
  214. })