particulars.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. import {
  2. ApiModel
  3. } from "../../../utils/api";
  4. const _Http = new ApiModel();
  5. const handleList = require("../../../utils/processingData");
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. recommendationList: [], //推荐列表
  12. particulars: {}, //详情
  13. ceiling: false, //是否吸顶
  14. Heitop: 0, //吸顶高度
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad: function (options) {
  20. let method = "query_supplyanddemandMain";
  21. if (options.type == 2) method = "query_mysupplyanddemandMain";
  22. _Http.basic({
  23. "accesstoken": wx.getStorageSync('userData').token,
  24. "classname": "customer.supplyanddemand.supplyanddemand",
  25. "method": method,
  26. "content": {
  27. "tsupplyanddemandid": options.tsupplyanddemandid
  28. }
  29. }).then(res => {
  30. console.log(res)
  31. if (res.msg != '成功') return wx.showToast({
  32. title: res.data,
  33. icon: "none"
  34. });
  35. let checkdate = res.data[0].checkdate;
  36. if (checkdate != '' && checkdate != null && checkdate != undefined) res.data[0].checkdate = checkdate.slice(0, checkdate.lastIndexOf('.'));
  37. const particulars = handleList.imageType(res.data[0], "default");
  38. this.setData({
  39. particulars
  40. })
  41. });
  42. /* 获取推荐列表 */
  43. _Http.basic({
  44. "accesstoken": wx.getStorageSync('userData').token,
  45. "classname": "customer.supplyanddemand.supplyanddemand",
  46. "method": "query_supplyanddemandList",
  47. "content": {
  48. "getdatafromdbanyway": true,
  49. "pageNumber": 2,
  50. "pageSize": 10,
  51. "where": {}
  52. }
  53. }).then(res => {
  54. console.log("查询列表", res)
  55. if (res.msg != '成功') return wx.showToast({
  56. title: res.data,
  57. icon: "none"
  58. });
  59. const data = handleList.checkdate(res.data)
  60. const recommendationList = handleList.imageType(data, "default");
  61. this.setData({
  62. recommendationList
  63. })
  64. })
  65. },
  66. /* 跳转商品详情页 */
  67. jumpForDetails(e) {
  68. const {
  69. index
  70. } = e.currentTarget.dataset,
  71. id = this.data.recommendationList[index].tsupplyanddemandid;
  72. wx.navigateTo({
  73. url: '/pages/tabbar-pages/supplyAndDemand/particulars?tsupplyanddemandid=' + id,
  74. })
  75. },
  76. /* 预览图片 */
  77. previewImage(e) {
  78. let imageList = this.data.particulars.attinfos,
  79. urls = [];
  80. for (let i = 0; i < imageList.length; i++) {
  81. urls.push(imageList[i].fobsurl)
  82. }
  83. const {
  84. index
  85. } = e.currentTarget.dataset
  86. wx.previewImage({
  87. urls: urls,
  88. current: index
  89. })
  90. },
  91. /* 阻止冒泡 */
  92. stop() {
  93. },
  94. /* 一键联系 */
  95. contact() {
  96. console.log('一键联系')
  97. },
  98. /**
  99. * 生命周期函数--监听页面初次渲染完成
  100. */
  101. onReady: function () {
  102. },
  103. /**
  104. * 生命周期函数--监听页面显示
  105. */
  106. onShow: function () {
  107. },
  108. /**
  109. * 生命周期函数--监听页面隐藏
  110. */
  111. onHide: function () {
  112. },
  113. /**
  114. * 生命周期函数--监听页面卸载
  115. */
  116. onUnload: function () {
  117. },
  118. /**
  119. * 页面相关事件处理函数--监听用户下拉动作
  120. */
  121. onPullDownRefresh: function () {
  122. },
  123. /**
  124. * 页面上拉触底事件的处理函数
  125. */
  126. onReachBottom: function () {
  127. },
  128. /**
  129. * 用户点击右上角分享
  130. */
  131. onShareAppMessage: function () {
  132. },
  133. })