// pages/shopinfo/shopinfo.js import storeApi from '../../api/store' import productApi from '../../api/product' Page({ /** * 页面的初始数据 */ data: { shopInfo: { shopImg: "../../images/shopImg.jpg", shopName: "大华店", stars: 5, shopAddress: "上海市宝山区域大华虎城A座10L", shopTel: "0556-7158735", products: [{ imgurl: "../../images/p1.jpg", title: "电影足疗60分钟", oldPrice: "298", newPrice: "198", discount: "6.7" }, { imgurl: "../../images/p2.jpg", title: "中式古法推拿套餐", oldPrice: "298", newPrice: "258", discount: "8.7" }, { imgurl: "../../images/p3.jpg", title: "小时代电影足疗90分钟", oldPrice: "368", newPrice: "258", discount: "7.0" }, { imgurl: "../../images/p4.jpg", title: "小时代PLUS电影足疗120分钟", oldPrice: "498", newPrice: "338", discount: "6.8" }, { imgurl: "../../images/p5.jpg", title: "采耳加钟", oldPrice: "298", newPrice: "198", discount: "6.7" }, { imgurl: "../../images/p6.jpg", title: "第六感精油SPA90分钟", oldPrice: "598", newPrice: "398", discount: "6.7" }, { imgurl: "../../images/p7.jpg", title: "温阳臀疗/肾疗", oldPrice: "880", newPrice: "668", discount: "7.6" }, { imgurl: "../../images/p8.jpg", title: "电全身淋巴排毒(含腹股沟)", oldPrice: "880", newPrice: "768", discount: "8.8" }, { imgurl: "../../images/p9.jpg", title: "神秘多巴胺组合套餐", oldPrice: "1688", newPrice: "1288", discount: "7.7" }, ], shopDesc: "本店所有商品照片为专业摄影师拍摄,后期起精心修制及色彩调整,尽量与实际商品保持一致,但由于拍摄时的用光、角度、显示器色彩偏差、个人对颜色的认知等方面的差异,导致实物可能会与照片存在一些色差,最终颜色以实际商品为准。" }, commentsList: [], productList: [] }, /** * 生命周期函数--监听页面加载 */ onLoad: async function (options) { var list = [{ id: 1, headImg: "../../images/headImg.jpg", product: "葛优躺(北京躺)电影足疗", assessDate: "2020-02-02", stars: 5, comments: { content: "3号技师特别好~~~赞一个,下次还来。", imgs: [{ imgurl: "../../images/commentsImg01.jpg" }, { imgurl: "../../images/commentsImg02.jpg" }, { imgurl: "../../images/commentsImg03.jpg" }, { imgurl: "../../images/commentsImg03.jpg" }, { imgurl: "../../images/commentsImg02.jpg" }, { imgurl: "../../images/commentsImg01.jpg" }, { imgurl: "../../images/commentsImg02.jpg" }, { imgurl: "../../images/commentsImg01.jpg" }, { imgurl: "../../images/commentsImg03.jpg" }, ] } }, { id: 2, headImg: "../../images/headImg.jpg", product: "葛优躺(北京躺)电影足疗", assessDate: "2020-02-02", stars: 5, comments: { content: "3号技师特别好~~~赞一个,下次还来。", imgs: [{ imgurl: "../../images/commentsImg01.jpg" }, ] } }, { id: 3, headImg: "../../images/headImg.jpg", product: "葛优躺(北京躺)电影足疗", assessDate: "2020-02-02", stars: 4, comments: { content: "3号技师特别好~~~赞一个,下次还来。", imgs: [] } }, { id: 4, headImg: "../../images/headImg.jpg", product: "葛优躺(北京躺)电影足疗", assessDate: "2020-02-02", stars: 5, comments: { content: "3号技师特别好~~~赞一个,下次还来。", imgs: [{ imgurl: "../../images/commentsImg01.jpg" }, { imgurl: "../../images/commentsImg02.jpg" }, { imgurl: "../../images/commentsImg01.jpg" }, { imgurl: "../../images/commentsImg03.jpg" }, ] } }, { id: 5, headImg: "../../images/headImg.jpg", product: "葛优躺(北京躺)电影足疗", assessDate: "2020-02-02", stars: 5, comments: { content: "3号技师特别好~~~赞一个,下次还来。", imgs: [{ imgurl: "../../images/commentsImg01.jpg" }, { imgurl: "../../images/commentsImg02.jpg" }, { imgurl: "../../images/commentsImg03.jpg" }, { imgurl: "../../images/commentsImg02.jpg" }, { imgurl: "../../images/commentsImg01.jpg" }, ] } }]; await this.getShopInfo(options.id); // this.setData({ // productList // }); /* this.setData({ shopId:options.id, productList, commentsList: list, }) */ }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, getShopInfo: async function (shopId) { const self = this; const productList = await productApi.getProductList(1, 100); const shopInfo = await storeApi.getStoreById(shopId); console.log(productList) self.setData({ productList, shopInfo: shopInfo.info }) }, showProduct: function (e) { console.log(e.currentTarget.dataset.productid) var productId = e.currentTarget.dataset.productid; var shopId = this.data.shopInfo.id; // console.log('shop='+shopId) wx.navigateTo({ url: '../product/product?shopId=' + shopId + '&productId=' + productId, }) } })