particulars.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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": 1,
  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. toLinkUp(e) {
  96. const {
  97. tsupplyanddemandid,
  98. tenterprise_userid
  99. } = e.currentTarget.dataset.item;
  100. if (tenterprise_userid == wx.getStorageSync('userData').userid) return;
  101. _Http.basic({
  102. "accesstoken": wx.getStorageSync('userData').token,
  103. "classname": "customer.supplyanddemand.supplyanddemand",
  104. "method": "OpenImDialog",
  105. "content": {
  106. "tsupplyanddemandid": tsupplyanddemandid
  107. }
  108. }).then(res => {
  109. if (res.msg != '成功') return wx.showToast({
  110. title: res.data,
  111. icon: "none"
  112. })
  113. wx.navigateTo({
  114. url: '/pages/chatRoom/dialogbox?id=' + res.data[0].timdialogid,
  115. })
  116. })
  117. },
  118. /**
  119. * 生命周期函数--监听页面初次渲染完成
  120. */
  121. onReady: function () {
  122. },
  123. /**
  124. * 生命周期函数--监听页面显示
  125. */
  126. onShow: function () {
  127. },
  128. /**
  129. * 生命周期函数--监听页面隐藏
  130. */
  131. onHide: function () {
  132. },
  133. /**
  134. * 生命周期函数--监听页面卸载
  135. */
  136. onUnload: function () {
  137. },
  138. /**
  139. * 页面相关事件处理函数--监听用户下拉动作
  140. */
  141. onPullDownRefresh: function () {
  142. },
  143. /**
  144. * 页面上拉触底事件的处理函数
  145. */
  146. onReachBottom: function () {
  147. },
  148. /**
  149. * 用户点击右上角分享
  150. */
  151. onShareAppMessage: function () {
  152. },
  153. })