eventDetail.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. // pages/actDetail/actDetail.js
  2. const app = getApp()
  3. var host = app.globalData.host;
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. info: {},
  10. uid: '',
  11. zk1: 0,
  12. zk2: 0,
  13. sex_array: ['男', '女'],
  14. sex: -1,
  15. job_array: ['非中科院单位','中科院单位'],
  16. job: 0,
  17. show: 0,
  18. list:[],
  19. index:[0,0,0],
  20. page:1,
  21. proof_img:'',
  22. user_id:'', //用户id
  23. apply_id:'', //报名ID
  24. phone:''
  25. },
  26. /**
  27. * 生命周期函数--监听页面加载
  28. */
  29. onLoad: function (options) {
  30. if (options.apply_id){
  31. this.setData({
  32. page: 3,
  33. show:1,
  34. apply_id: options.apply_id
  35. })
  36. }
  37. var that = this;
  38. wx.showNavigationBarLoading()
  39. var that = this;
  40. wx.getStorage({
  41. key: 'uid',
  42. success: res => {
  43. if (res.data) {
  44. this.setData({
  45. user_id: res.data
  46. })
  47. }
  48. },
  49. })
  50. wx.request({
  51. url: host + '/api/detail',
  52. method: 'GET',
  53. data: {
  54. type: 'conference',
  55. id: options.id
  56. },
  57. success: function (res) {
  58. wx.hideNavigationBarLoading();
  59. that.setData({
  60. info: res.data.data
  61. })
  62. },
  63. fail: function () {
  64. wx.hideLoading();
  65. wx.showToast({
  66. title: '服务器开小差啦!',
  67. icon: 'none'
  68. })
  69. }
  70. })
  71. //中科院单位
  72. wx.request({
  73. url: host + '/api/organization/list',
  74. method: 'GET',
  75. success: function (res) {
  76. wx.hideNavigationBarLoading();
  77. var list=[];
  78. list[0] = res.data.data;
  79. list[1] = list[0][0].children;
  80. list[2] = list[1][0].children;
  81. that.setData({
  82. list: list
  83. })
  84. },
  85. })
  86. },
  87. upload:function(){
  88. wx.chooseImage({
  89. count:0,
  90. success: res=>{
  91. wx.showLoading({
  92. title: '正在上传',
  93. })
  94. wx.uploadFile({
  95. url: host + '/api/uploadfile',
  96. filePath: res.tempFilePaths[0],
  97. name: 'file',
  98. success:response=>{
  99. wx.hideLoading();
  100. let data = JSON.parse(response.data);
  101. this.setData({
  102. proof_img:data.data
  103. })
  104. }
  105. })
  106. },
  107. })
  108. },
  109. phoneChange:function(e){
  110. this.setData({
  111. phone: e.detail.value
  112. })
  113. },
  114. sendcode:function(){
  115. if(this.data.phone.length<11){
  116. wx.showToast({
  117. title: '请输入正确的手机号',
  118. icon: 'none'
  119. })
  120. return;
  121. }
  122. wx.request({
  123. url: host + '/api/phcode',
  124. method: 'POST',
  125. data: { phone: this.data.phone},
  126. success: function (res) {
  127. if(res.data.code == 0){
  128. wx.showToast({
  129. title: '验证码已发送',
  130. })
  131. }else{
  132. wx.showToast({
  133. title: '发送失败',
  134. icon: 'none'
  135. })
  136. }
  137. },
  138. })
  139. },
  140. bindMultiPickerColumnChange:function(e){
  141. console.log('修改的列为', e.detail.column, ',值为', e.detail.value);
  142. var list = this.data.list, i = e.detail.value, j = e.detail.column;
  143. var index=this.data.index;
  144. index[j] = i
  145. if (e.detail.column == 0){
  146. list[1] = list[i][0].children;
  147. list[2] = list[1][0].children;
  148. index[1]=0;
  149. index[2]=0;
  150. }
  151. if (e.detail.column == 1) {
  152. list[1] = list[i][0].children;
  153. list[2] = list[1][0].children;
  154. index[2] = 0;
  155. }
  156. this.setData({
  157. list: list,
  158. index: index
  159. })
  160. },
  161. bindSexChange:function(e){
  162. this.setData({
  163. sex: e.detail.value
  164. })
  165. },
  166. bindPickerChange:function(e){
  167. this.setData({
  168. job: e.detail.value
  169. })
  170. },
  171. skip:function(){
  172. this.setData({
  173. page: this.data.page+2
  174. })
  175. },
  176. sure: function () {
  177. this.setData({
  178. page: this.data.page + 1
  179. })
  180. },
  181. close:function(){
  182. this.setData({
  183. show: 0
  184. })
  185. },
  186. open: function () {
  187. this.setData({
  188. show: 1
  189. })
  190. },
  191. //提交报名信息
  192. submit: function (e) {
  193. var form = e.detail.value;
  194. var list = this.data.list, index=this.data.index;
  195. form.organizer_unit = list[0][index[0]].value+list[1][index[1]].value+list[2][index[2]].value
  196. form.uid=this.data.user_id;
  197. form.conference_id=this.data.info.id;
  198. form.conference_name = this.data.info.name;
  199. if(!form.name){
  200. wx.showToast({
  201. title: '请输入姓名!',
  202. icon:'none'
  203. })
  204. return;
  205. }
  206. if (!form.job) {
  207. wx.showToast({
  208. title: '请输入职务!',
  209. icon: 'none'
  210. })
  211. return;
  212. }
  213. if (!form.phone) {
  214. wx.showToast({
  215. title: '请输入手机号!',
  216. icon: 'none'
  217. })
  218. return;
  219. }
  220. if (!form.code) {
  221. wx.showToast({
  222. title: '请输入验证码!',
  223. icon: 'none'
  224. })
  225. return;
  226. }
  227. wx.showLoading({
  228. title: '正在提交',
  229. })
  230. wx.request({
  231. url: host + '/api/user/signup',
  232. method:'POST',
  233. data: form,
  234. success:(res=>{
  235. if(res.data.code == 0){
  236. wx.hideLoading()
  237. this.setData({
  238. page: 2,
  239. apply_id:res.data.data
  240. })
  241. }else{
  242. wx.showToast({
  243. title: '提交失败',
  244. icon:'none'
  245. })
  246. }
  247. })
  248. })
  249. },
  250. //提交凭证
  251. submit1:function(e){
  252. var form = e.detail.value;
  253. form.id=this.data.apply_id;
  254. form.proof_img = this.data.proof_img;
  255. if (!form.proof_img) {
  256. wx.showToast({
  257. title: '请上传凭证!',
  258. icon: 'none'
  259. })
  260. return;
  261. }
  262. if (!form.paytype) {
  263. wx.showToast({
  264. title: '请选择支付方式!',
  265. icon: 'none'
  266. })
  267. return;
  268. }
  269. if (!form.billtype) {
  270. wx.showToast({
  271. title: '请选择发票类型!',
  272. icon: 'none'
  273. })
  274. return;
  275. }
  276. if (!form.billhead) {
  277. wx.showToast({
  278. title: '请输入发票抬头!',
  279. icon: 'none'
  280. })
  281. return;
  282. }
  283. if (!form.billno) {
  284. wx.showToast({
  285. title: '请输入识别号!',
  286. icon: 'none'
  287. })
  288. return;
  289. }
  290. if (!form.billaddress || !form.billphone || !form.billbank || !form.billbankno) {
  291. wx.showToast({
  292. title: '请填写完整的发票信息!',
  293. icon: 'none'
  294. })
  295. return;
  296. }
  297. wx.showLoading({
  298. title: '正在提交',
  299. })
  300. wx.request({
  301. url: host + '/api/user/signup',
  302. method: 'PUT',
  303. data: e.detail.value,
  304. success: (res => {
  305. wx.hideLoading();
  306. if (res.data.code == 0) {
  307. wx.showToast({
  308. title: '提交成功',
  309. })
  310. this.skip();
  311. }
  312. }),
  313. fail:error=>{
  314. wx.hideLoading()
  315. }
  316. })
  317. },
  318. home:function(){
  319. wx.switchTab({
  320. url: '../mine/mine',
  321. })
  322. },
  323. zk1: function () {
  324. this.setData({
  325. zk1: 1
  326. })
  327. },
  328. sq1: function () {
  329. this.setData({
  330. zk1: 0
  331. })
  332. },
  333. zk2: function () {
  334. this.setData({
  335. zk2: 1
  336. })
  337. },
  338. sq2: function () {
  339. this.setData({
  340. zk2: 0
  341. })
  342. },
  343. /**
  344. * 生命周期函数--监听页面初次渲染完成
  345. */
  346. onReady: function () {
  347. },
  348. /**
  349. * 生命周期函数--监听页面显示
  350. */
  351. onShow: function () {
  352. },
  353. /**
  354. * 生命周期函数--监听页面隐藏
  355. */
  356. onHide: function () {
  357. },
  358. /**
  359. * 生命周期函数--监听页面卸载
  360. */
  361. onUnload: function () {
  362. },
  363. /**
  364. * 页面相关事件处理函数--监听用户下拉动作
  365. */
  366. onPullDownRefresh: function () {
  367. },
  368. /**
  369. * 页面上拉触底事件的处理函数
  370. */
  371. onReachBottom: function () {
  372. },
  373. /**
  374. * 用户点击右上角分享
  375. */
  376. onShareAppMessage: function () {
  377. }
  378. })