var utils=require("../../../utils/helper.js"),WxParse=require("../../../wxParse/wxParse.js"),gSpecificationsModel=require("../../../components/goods/specifications_model.js"),goodsBanner=require("../../../components/goods/goods_banner.js"),goodsInfo=require("../../../components/goods/goods_info.js"),goodsBuy=require("../../../components/goods/goods_buy.js"),p=1,is_loading_comment=!1,is_more_comment=!0;Page({data:{pageType:"BOOK",hide:"hide",form:{number:1},tab_detail:"active",tab_comment:"",comment_list:[],comment_count:{score_all:0,score_3:0,score_2:0,score_1:0}},onLoad:function(t){getApp().page.onLoad(this,t);var e=t.user_id,o=decodeURIComponent(t.scene);if(void 0!==e)e;else if(void 0!==o){var a=utils.scene_decode(o);a.uid&&a.gid?(a.uid,t.id=a.gid):o}else if(null!==getApp().query){var i=getApp().query;getApp().query=null,t.id=i.gid,i.uid}this.setData({id:t.id}),p=1,this.getGoodsInfo(t),this.getCommentList(!1)},onReady:function(t){getApp().page.onReady(this)},onShow:function(t){getApp().page.onShow(this),gSpecificationsModel.init(this),goodsBanner.init(this),goodsInfo.init(this),goodsBuy.init(this)},onHide:function(t){getApp().page.onHide(this)},onUnload:function(t){getApp().page.onUnload(this)},onPullDownRefresh:function(t){getApp().page.onPullDownRefresh(this)},onReachBottom:function(t){getApp().page.onReachBottom(this);this.getCommentList(!0)},onShareAppMessage:function(t){getApp().page.onShareAppMessage(this);var e=this,o=getApp().core.getStorageSync(getApp().const.USER_INFO);return{title:e.data.goods.name,path:"/pages/book/details/details?id="+e.data.goods.id+"&user_id="+o.id,imageUrl:e.data.goods.pic_list[0],success:function(t){}}},getGoodsInfo:function(t){var e=t.id,i=this;getApp().core.showLoading({title:"正在加载",mask:!0}),getApp().request({url:getApp().api.book.details,method:"get",data:{gid:e},success:function(t){if(0==t.code){var e=t.data.info.detail;WxParse.wxParse("detail","html",e,i);var o=parseInt(t.data.info.virtual_sales)+parseInt(t.data.info.sales);t.data.attr_group_list.length<=0&&(t.data.attr_group_list=[{attr_group_name:"规格",attr_list:[{attr_id:0,attr_name:"默认",checked:!0}]}]);var a=t.data.info;a.num=t.data.info.stock,a.min_price=.01