product.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. // pages/productinfo/productinfo.js
  2. import productApi from '../../api/product'
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. productinfo: {
  9. title: "葛优躺(北京躺)电影足疗",
  10. price: "666",
  11. commentsList: []
  12. },
  13. shopId: 0,
  14. productId: 0,
  15. product: {}
  16. },
  17. /**
  18. * 生命周期函数--监听页面加载
  19. */
  20. onLoad: async function (options) {
  21. wx.showLoading({
  22. title: '加载中',
  23. })
  24. var shopId = options.shopId;
  25. var productId = options.productId;
  26. var product = await productApi.getProductById(productId);
  27. this.setData({
  28. shopId,
  29. productId,
  30. product: product.info
  31. })
  32. /* var list = [{
  33. id: 1,
  34. headImg: "../../images/headImg.jpg",
  35. product: "葛优躺(北京躺)电影足疗",
  36. assessDate: "2020-02-02",
  37. stars: 5,
  38. comments: {
  39. content: "3号技师特别好~~~赞一个,下次还来。",
  40. imgs: [{
  41. imgurl: "../../images/commentsImg01.jpg"
  42. },
  43. {
  44. imgurl: "../../images/commentsImg02.jpg"
  45. },
  46. {
  47. imgurl: "../../images/commentsImg03.jpg"
  48. },
  49. {
  50. imgurl: "../../images/commentsImg03.jpg"
  51. },
  52. {
  53. imgurl: "../../images/commentsImg02.jpg"
  54. },
  55. {
  56. imgurl: "../../images/commentsImg01.jpg"
  57. },
  58. {
  59. imgurl: "../../images/commentsImg02.jpg"
  60. },
  61. {
  62. imgurl: "../../images/commentsImg01.jpg"
  63. },
  64. {
  65. imgurl: "../../images/commentsImg03.jpg"
  66. },
  67. ]
  68. }
  69. }, {
  70. id: 2,
  71. headImg: "../../images/headImg.jpg",
  72. product: "葛优躺(北京躺)电影足疗",
  73. assessDate: "2020-02-02",
  74. stars: 5,
  75. comments: {
  76. content: "3号技师特别好~~~赞一个,下次还来。",
  77. imgs: [{
  78. imgurl: "../../images/commentsImg01.jpg"
  79. },
  80. ]
  81. }
  82. }, {
  83. id: 3,
  84. headImg: "../../images/headImg.jpg",
  85. product: "葛优躺(北京躺)电影足疗",
  86. assessDate: "2020-02-02",
  87. stars: 4,
  88. comments: {
  89. content: "3号技师特别好~~~赞一个,下次还来。",
  90. imgs: []
  91. }
  92. }, {
  93. id: 4,
  94. headImg: "../../images/headImg.jpg",
  95. product: "葛优躺(北京躺)电影足疗",
  96. assessDate: "2020-02-02",
  97. stars: 5,
  98. comments: {
  99. content: "3号技师特别好~~~赞一个,下次还来。",
  100. imgs: [{
  101. imgurl: "../../images/commentsImg01.jpg"
  102. },
  103. {
  104. imgurl: "../../images/commentsImg02.jpg"
  105. },
  106. {
  107. imgurl: "../../images/commentsImg01.jpg"
  108. },
  109. {
  110. imgurl: "../../images/commentsImg03.jpg"
  111. },
  112. ]
  113. }
  114. }, {
  115. id: 5,
  116. headImg: "../../images/headImg.jpg",
  117. product: "葛优躺(北京躺)电影足疗",
  118. assessDate: "2020-02-02",
  119. stars: 5,
  120. comments: {
  121. content: "3号技师特别好~~~赞一个,下次还来。",
  122. imgs: [{
  123. imgurl: "../../images/commentsImg01.jpg"
  124. },
  125. {
  126. imgurl: "../../images/commentsImg02.jpg"
  127. },
  128. {
  129. imgurl: "../../images/commentsImg03.jpg"
  130. },
  131. {
  132. imgurl: "../../images/commentsImg02.jpg"
  133. },
  134. {
  135. imgurl: "../../images/commentsImg01.jpg"
  136. },
  137. ]
  138. }
  139. }];
  140. this.setData({
  141. // id: options.id,
  142. commentsList: list,
  143. })
  144. */
  145. },
  146. /**
  147. * 生命周期函数--监听页面初次渲染完成
  148. */
  149. onReady: function () {
  150. },
  151. /**
  152. * 生命周期函数--监听页面显示
  153. */
  154. onShow: function () {
  155. },
  156. /**
  157. * 生命周期函数--监听页面隐藏
  158. */
  159. onHide: function () {
  160. },
  161. /**
  162. * 生命周期函数--监听页面卸载
  163. */
  164. onUnload: function () {
  165. },
  166. /**
  167. * 页面相关事件处理函数--监听用户下拉动作
  168. */
  169. onPullDownRefresh: function () {
  170. },
  171. /**
  172. * 页面上拉触底事件的处理函数
  173. */
  174. onReachBottom: function () {
  175. },
  176. /**
  177. * 用户点击右上角分享
  178. */
  179. onShareAppMessage: function () {
  180. },
  181. gotoAllComments: function (e) {
  182. var shopId = this.data.shopId;
  183. var productId = this.data.productId;
  184. wx.navigateTo({
  185. url: '../comments/comments?title=全部评论&commentstype=all&shopId='+shopId+'&productId='+productId,
  186. })
  187. },
  188. gotoAppointment:function (e) {
  189. var shopId = this.data.shopId;
  190. var productId = this.data.productId;
  191. wx.navigateTo({
  192. url: '../appointment/appointment?shopId='+shopId+'&productId='+productId,
  193. })
  194. }
  195. })