details.js 2.7 KB

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