details.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import {
  2. ApiModel
  3. } from "../../utils/api"
  4. const _Http = new ApiModel();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. recommendationList: []
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function (options) {
  16. //供需详情
  17. _Http.basic({
  18. "classname": "publicmethod.homepage.homepage",
  19. "method": "query_supplyanddemandMain",
  20. "content": {
  21. "tsupplyanddemandid": options.tsupplyanddemandid,
  22. "tagentsid": options.tagentsid
  23. }
  24. }).then(res => {
  25. console.log(res)
  26. res.data[0].checkdate = res.data[0].checkdate.slice(0, res.data[0].checkdate.lastIndexOf('.'));
  27. this.setData({
  28. particulars: res.data[0]
  29. })
  30. });
  31. //门户供需列表
  32. _Http.basic({
  33. "classname": "publicmethod.homepage.homepage",
  34. "method": "query_supplyanddemandList",
  35. "content": {
  36. "getdatafromdbanyway": true,
  37. "pageNumber": 1,
  38. "pageSize": 8,
  39. "siteid": "BWJ",
  40. "where": {
  41. "ftype": ""
  42. }
  43. }
  44. }).then(res => {
  45. if (res.msg != '成功') return wx.showToast({
  46. title: res.data,
  47. icon: "none"
  48. });
  49. for (let i = 0; i < res.data.length; i++) {
  50. res.data[i].checkdate = res.data[i].checkdate.slice(0, res.data[i].checkdate.lastIndexOf('.'));
  51. }
  52. this.setData({
  53. recommendationList: res.data
  54. })
  55. })
  56. },
  57. jumpForDetails(e) {
  58. const {
  59. index
  60. } = e.currentTarget.dataset;
  61. const data = this.data.recommendationList[index];
  62. wx.navigateTo({
  63. url: './details?tagentsid=' + data.tagentsid + '&tsupplyanddemandid=' + data.tsupplyanddemandid,
  64. })
  65. },
  66. /**
  67. * 生命周期函数--监听页面初次渲染完成
  68. */
  69. onReady: function () {
  70. },
  71. /**
  72. * 生命周期函数--监听页面显示
  73. */
  74. onShow: function () {
  75. },
  76. /**
  77. * 生命周期函数--监听页面隐藏
  78. */
  79. onHide: function () {
  80. },
  81. /**
  82. * 生命周期函数--监听页面卸载
  83. */
  84. onUnload: function () {
  85. },
  86. /**
  87. * 页面相关事件处理函数--监听用户下拉动作
  88. */
  89. onPullDownRefresh: function () {
  90. },
  91. /**
  92. * 页面上拉触底事件的处理函数
  93. */
  94. onReachBottom: function () {
  95. },
  96. /**
  97. * 用户点击右上角分享
  98. */
  99. onShareAppMessage: function () {
  100. }
  101. })