shopinfo.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. // pages/shopinfo/shopinfo.js
  2. import storeApi from '../../api/store'
  3. import productApi from '../../api/product'
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. shopInfo: {
  10. shopImg: "../../images/shopImg.jpg",
  11. shopName: "大华店",
  12. stars: 5,
  13. shopAddress: "上海市宝山区域大华虎城A座10L",
  14. shopTel: "0556-7158735",
  15. products: [{
  16. imgurl: "../../images/p1.jpg",
  17. title: "电影足疗60分钟",
  18. oldPrice: "298",
  19. newPrice: "198",
  20. discount: "6.7"
  21. },
  22. {
  23. imgurl: "../../images/p2.jpg",
  24. title: "中式古法推拿套餐",
  25. oldPrice: "298",
  26. newPrice: "258",
  27. discount: "8.7"
  28. }, {
  29. imgurl: "../../images/p3.jpg",
  30. title: "小时代电影足疗90分钟",
  31. oldPrice: "368",
  32. newPrice: "258",
  33. discount: "7.0"
  34. }, {
  35. imgurl: "../../images/p4.jpg",
  36. title: "小时代PLUS电影足疗120分钟",
  37. oldPrice: "498",
  38. newPrice: "338",
  39. discount: "6.8"
  40. }, {
  41. imgurl: "../../images/p5.jpg",
  42. title: "采耳加钟",
  43. oldPrice: "298",
  44. newPrice: "198",
  45. discount: "6.7"
  46. }, {
  47. imgurl: "../../images/p6.jpg",
  48. title: "第六感精油SPA90分钟",
  49. oldPrice: "598",
  50. newPrice: "398",
  51. discount: "6.7"
  52. }, {
  53. imgurl: "../../images/p7.jpg",
  54. title: "温阳臀疗/肾疗",
  55. oldPrice: "880",
  56. newPrice: "668",
  57. discount: "7.6"
  58. }, {
  59. imgurl: "../../images/p8.jpg",
  60. title: "电全身淋巴排毒(含腹股沟)",
  61. oldPrice: "880",
  62. newPrice: "768",
  63. discount: "8.8"
  64. }, {
  65. imgurl: "../../images/p9.jpg",
  66. title: "神秘多巴胺组合套餐",
  67. oldPrice: "1688",
  68. newPrice: "1288",
  69. discount: "7.7"
  70. },
  71. ],
  72. shopDesc: "本店所有商品照片为专业摄影师拍摄,后期起精心修制及色彩调整,尽量与实际商品保持一致,但由于拍摄时的用光、角度、显示器色彩偏差、个人对颜色的认知等方面的差异,导致实物可能会与照片存在一些色差,最终颜色以实际商品为准。"
  73. },
  74. commentsList: [],
  75. productList: []
  76. },
  77. /**
  78. * 生命周期函数--监听页面加载
  79. */
  80. onLoad: async function (options) {
  81. var list = [{
  82. id: 1,
  83. headImg: "../../images/headImg.jpg",
  84. product: "葛优躺(北京躺)电影足疗",
  85. assessDate: "2020-02-02",
  86. stars: 5,
  87. comments: {
  88. content: "3号技师特别好~~~赞一个,下次还来。",
  89. imgs: [{
  90. imgurl: "../../images/commentsImg01.jpg"
  91. },
  92. {
  93. imgurl: "../../images/commentsImg02.jpg"
  94. },
  95. {
  96. imgurl: "../../images/commentsImg03.jpg"
  97. },
  98. {
  99. imgurl: "../../images/commentsImg03.jpg"
  100. },
  101. {
  102. imgurl: "../../images/commentsImg02.jpg"
  103. },
  104. {
  105. imgurl: "../../images/commentsImg01.jpg"
  106. },
  107. {
  108. imgurl: "../../images/commentsImg02.jpg"
  109. },
  110. {
  111. imgurl: "../../images/commentsImg01.jpg"
  112. },
  113. {
  114. imgurl: "../../images/commentsImg03.jpg"
  115. },
  116. ]
  117. }
  118. }, {
  119. id: 2,
  120. headImg: "../../images/headImg.jpg",
  121. product: "葛优躺(北京躺)电影足疗",
  122. assessDate: "2020-02-02",
  123. stars: 5,
  124. comments: {
  125. content: "3号技师特别好~~~赞一个,下次还来。",
  126. imgs: [{
  127. imgurl: "../../images/commentsImg01.jpg"
  128. },
  129. ]
  130. }
  131. }, {
  132. id: 3,
  133. headImg: "../../images/headImg.jpg",
  134. product: "葛优躺(北京躺)电影足疗",
  135. assessDate: "2020-02-02",
  136. stars: 4,
  137. comments: {
  138. content: "3号技师特别好~~~赞一个,下次还来。",
  139. imgs: []
  140. }
  141. }, {
  142. id: 4,
  143. headImg: "../../images/headImg.jpg",
  144. product: "葛优躺(北京躺)电影足疗",
  145. assessDate: "2020-02-02",
  146. stars: 5,
  147. comments: {
  148. content: "3号技师特别好~~~赞一个,下次还来。",
  149. imgs: [{
  150. imgurl: "../../images/commentsImg01.jpg"
  151. },
  152. {
  153. imgurl: "../../images/commentsImg02.jpg"
  154. },
  155. {
  156. imgurl: "../../images/commentsImg01.jpg"
  157. },
  158. {
  159. imgurl: "../../images/commentsImg03.jpg"
  160. },
  161. ]
  162. }
  163. }, {
  164. id: 5,
  165. headImg: "../../images/headImg.jpg",
  166. product: "葛优躺(北京躺)电影足疗",
  167. assessDate: "2020-02-02",
  168. stars: 5,
  169. comments: {
  170. content: "3号技师特别好~~~赞一个,下次还来。",
  171. imgs: [{
  172. imgurl: "../../images/commentsImg01.jpg"
  173. },
  174. {
  175. imgurl: "../../images/commentsImg02.jpg"
  176. },
  177. {
  178. imgurl: "../../images/commentsImg03.jpg"
  179. },
  180. {
  181. imgurl: "../../images/commentsImg02.jpg"
  182. },
  183. {
  184. imgurl: "../../images/commentsImg01.jpg"
  185. },
  186. ]
  187. }
  188. }];
  189. await this.getShopInfo(options.id);
  190. // this.setData({
  191. // productList
  192. // });
  193. /* this.setData({
  194. shopId:options.id,
  195. productList,
  196. commentsList: list,
  197. })
  198. */
  199. },
  200. /**
  201. * 生命周期函数--监听页面初次渲染完成
  202. */
  203. onReady: function () {
  204. },
  205. /**
  206. * 生命周期函数--监听页面显示
  207. */
  208. onShow: function () {
  209. },
  210. /**
  211. * 生命周期函数--监听页面隐藏
  212. */
  213. onHide: function () {
  214. },
  215. /**
  216. * 生命周期函数--监听页面卸载
  217. */
  218. onUnload: function () {
  219. },
  220. /**
  221. * 页面相关事件处理函数--监听用户下拉动作
  222. */
  223. onPullDownRefresh: function () {
  224. },
  225. /**
  226. * 页面上拉触底事件的处理函数
  227. */
  228. onReachBottom: function () {
  229. },
  230. /**
  231. * 用户点击右上角分享
  232. */
  233. onShareAppMessage: function () {
  234. },
  235. getShopInfo: async function (shopId) {
  236. const self = this;
  237. const productList = await productApi.getProductList(1, 100);
  238. const shopInfo = await storeApi.getStoreById(shopId);
  239. console.log(productList)
  240. self.setData({
  241. productList,
  242. shopInfo: shopInfo.info
  243. })
  244. },
  245. showProduct: function (e) {
  246. console.log(e.currentTarget.dataset.productid)
  247. var productId = e.currentTarget.dataset.productid;
  248. var shopId = this.data.shopInfo.id;
  249. // console.log('shop='+shopId)
  250. wx.navigateTo({
  251. url: '../product/product?shopId=' + shopId + '&productId=' + productId,
  252. })
  253. }
  254. })