sucReception.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // pages/sucReception/sucReception.js
  2. import {
  3. get,
  4. } from '../../utils/http';
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. invite_info: {
  11. avatar_url: '',
  12. product_name: '',
  13. product_desc: '',
  14. price: '',
  15. project_id: '',
  16. store_id: '',
  17. nickname:'',
  18. coupon_day:''
  19. },
  20. sourceType: 1,
  21. source: 'project',
  22. },
  23. /**
  24. * 生命周期函数--监听页面加载
  25. */
  26. onLoad: function (options) {
  27. this.getReceive()
  28. },
  29. /**
  30. * 生命周期函数--监听页面初次渲染完成
  31. */
  32. onReady: function () {
  33. },
  34. /**
  35. * 生命周期函数--监听页面显示
  36. */
  37. onShow: function () {
  38. },
  39. /**
  40. * 获取领取数据
  41. * /api/invite/receive_info
  42. */
  43. getReceive() {
  44. get('api/invite/receive_info', {}, res => {
  45. this.setData({
  46. invite_info: res.data
  47. })
  48. this.getStoreInfo()
  49. })
  50. },
  51. /**
  52. * 获取门店信息
  53. */
  54. getStoreInfo() {
  55. get(
  56. 'api/store/info', {
  57. store_id: this.data.invite_info.store_id
  58. },
  59. (res) => {
  60. getApp().globalData.storeData = res.data
  61. }
  62. )
  63. },
  64. /**
  65. * 获取详情页数据
  66. */
  67. getProjectInfo() {
  68. get(
  69. 'api/product/info', {
  70. store_id: this.data.invite_info.store_id,
  71. product_id: this.data.invite_info.project_id,
  72. type: this.data.sourceType
  73. },
  74. (res) => {
  75. // let content = this.removeCss(res.data.content)
  76. // res.data.content = this.removeCss(res.data.content)
  77. // WxParse.wxParse('article', 'html', content, this, 5)
  78. this.setData({
  79. projectData: res.data
  80. })
  81. let _projectData = Object.assign({}, this.data.projectData)
  82. delete _projectData.content
  83. let url = `/pages/reserveProject/reserveProject?source=${
  84. this.data.source
  85. }&projectData=${encodeURIComponent(JSON.stringify(_projectData))}`
  86. wx.navigateTo({
  87. url: url
  88. })
  89. }
  90. )
  91. },
  92. })