// pages/details/details.js Page({ /** * 页面的初始数据 */ data: { p_id:"", search_id:"", goods_sign:"", }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that=this const goodsSign=options.goodsSign const searchId=options.searchId const pid = "9112489_209622235" that.p_id = pid that.goods_sign = goodsSign that.search_id = searchId wx.request({ url: 'http://49.234.19.130:8081/v1/pdd/ddk/detail', data: { goods_sign: goodsSign, search_id: searchId,pid: pid }, header: { "Content-Type": "application/json" }, method: "POST", success (res) { console.log(res) that.setData({ goodsDetails: res.data.data.goods_detail_response.goods_details, searchId:searchId }) } }) }, counponBtn:function(e){ var that = this console.log("pdd") wx.request({ url: 'http://49.234.19.130:8081/v1/pdd/url/generate', data: { goods_sign_list: [that.goods_sign], search_id: that.search_id,p_id: that.p_id,generate_we_app:"true" }, header: { "Content-Type": "application/json" }, method: "POST", success (res) { console.log(res) // that.setData({ // goodsDetails: res.data.data.goods_detail_response.goods_details, // searchId:searchId // }) console.log(res.data.data.goods_promotion_url_generate_response.goods_promotion_url_list[0].we_app_info.page_path) let path = res.data.data.goods_promotion_url_generate_response.goods_promotion_url_list[0].we_app_info.page_path //let path = res.data.data.goods_promotion_url_generate_response.goods_promotion_url_list[0].we_app_web_view_short_url wx.navigateToMiniProgram({ appId: 'wx32540bd863b27570', path: path, success(res) { } }) } }) }, bindscroll(e) { //计算页面 轮播图、详情、评价(砍价)view 高度 this.getTopHeightFunction() var tabsHeight = this.data.tabsHeight //顶部距离(tabs高度) if (this.data.tabs[0].topHeight-tabsHeight<=0 && 0 < this.data.tabs[1].topHeight-tabsHeight) { //临界值,根据自己的需求来调整 this.setData({ active: this.data.tabs[0].tabs_name //设置当前标签栏 }) } else if (this.data.tabs.length == 2) { this.setData({ active: this.data.tabs[1].tabs_name }) } else if (this.data.tabs[1].topHeight-tabsHeight<=0 && 0 < this.data.tabs[2].topHeight-tabsHeight) { this.setData({ active: this.data.tabs[1].tabs_name }) } else if (this.data.tabs[2].topHeight-tabsHeight<=0) { this.setData({ active: this.data.tabs[2].tabs_name }) } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })