category.js 6.0 KB

1
  1. require('../../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["bundle/pages/category/category"],{"0e31":function(e,t,n){"use strict";(function(e,t){var s=n("47a9");n("b46f");s(n("3240"));var i=s(n("347e"));e.__webpack_require_UNI_MP_PLUGIN__=n,t(i.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])},"347e":function(e,t,n){"use strict";n.r(t);var s=n("996f"),i=n("6637");for(var r in i)["default"].indexOf(r)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(r);n("6e3b");var o=n("828b"),c=Object(o["a"])(i["default"],s["b"],s["c"],!1,null,"3d261834",null,!1,s["a"],void 0);t["default"]=c.exports},6637:function(e,t,n){"use strict";n.r(t);var s=n("73dc"),i=n.n(s);for(var r in s)["default"].indexOf(r)<0&&function(e){n.d(t,e,(function(){return s[e]}))}(r);t["default"]=i.a},"6e3b":function(e,t,n){"use strict";var s=n("df46"),i=n.n(s);i.a},"73dc":function(e,t,n){"use strict";(function(e){var s=n("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=s(n("af34")),r=s(n("7ca3")),o=n("30a0"),c=s(n("2bc2")),a=n("dc70"),u=n("7398");function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){(0,r.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var h={name:"Search",mixins:[c.default],data:function(){return{height:0,categoryId:"",showScreen:!1,goodsList:[],searchStatus:!1,goodsCardStyle:"square",search:{is_member_price:"",max_price:"",min_price:"",name:"",category_id:"",price:"",sale:"",brand_id:""},brandLists:[],vipLists:[{name:"参与",value:1},{name:"不参与",value:0}],lists:[],flattenLists:[],banner:{content:{data:[]},styles:""}}},methods:{getBanner:function(){var e=this;(0,a.apiGetPage)({type:2}).then((function(t){var n=t.content;e.banner.content.data=[n[1].content.data.find((function(t){return t.category.id==e.categoryId}))],e.banner.styles={border_radius:3,indicator_align:"center",indicator_color:"#FF2C3C",indicator_style:2,padding_horizontal:10,padding_top:10}}))},setTitle:function(){var t=this,n="";this.flattenLists.find((function(e){e.id==t.categoryId&&(n=e.name)})),e.setNavigationBarTitle({title:n})},getLists:function(){var e=this;(0,o.apiGoodsCategory)().then((function(t){e.lists=t.lists,e.flattenLists=(0,u.flattenArray)(t.lists,"sons"),e.setTitle()}))},mescrollInit:function(e){this.mescroll=e},downCallback:function(){this.mescroll.resetUpScroll()},upCallback:function(e){var t=this,n=e.num,s=e.size;(0,o.apiGoodsLists)(d(d({},this.search),{},{category_id:this.categoryId,page_no:n,page_size:s})).then((function(n){var s=n.lists,r=(n.page_size,n.count);1==e.num&&(t.goodsList=[]),t.goodsList=[].concat((0,i.default)(t.goodsList),(0,i.default)(s)),t.mescroll.endSuccess(s.length,r)})).catch((function(){t.mescroll.endErr()}))},goSearch:function(){this.$Router.push({path:"/pages/goods_search/goods_search",query:{category_id:this.categoryId}})},goGoodsDetail:function(e){this.$Router.push({path:"/pages/goods_detail/goods_detail",query:{id:e}})},handleSearch:function(e){this.searchStatus=!0,this.$set(this.search,"name",e),this.mescroll&&this.mescroll.resetUpScroll()},handlemenber:function(e){this.search.is_member_price=e},handSortOptions:function(e){switch(e){case"all":this.$set(this.search,"sale",""),this.$set(this.search,"price","");break;case"sale":this.$set(this.search,"price",""),this.$set(this.search,"sale",this.getSortReverse(this.search.sale));break;case"price":this.$set(this.search,"sale",""),this.$set(this.search,"price",this.getSortReverse(this.search.price));break}this.mescroll.resetUpScroll()},getSortReverse:function(e){switch(e){case"asc":return"desc";case"desc":return"asc";default:return"desc"}},getSearchList:function(){var e=this;(0,o.apiBrandLists)({page_size:999}).then((function(t){e.brandLists=t.lists}))},handleScreen:function(e){this.search.brand_id=e.id},handleConfirm:function(){this.showScreen=!1,this.mescroll.resetUpScroll()},handleReset:function(){this.search.brand_id="",this.search.is_member_price="",this.search.max_price="",this.search.min_price="",this.showScreen=!1,this.mescroll.resetUpScroll()}},onLoad:function(){var t=this.$Route.query;this.categoryId=t.id,this.getSearchList(),this.getLists(),this.getBanner(),console.log(e.getSystemInfoSync().windowHeight),this.height=this.$px2rpx(e.getSystemInfoSync().windowHeight-41-(0,u.getSafeBottom)())}};t.default=h}).call(this,n("df3c")["default"])},"996f":function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){return s}));var s={wBanner:function(){return n.e("components/widgets/banner/banner").then(n.bind(null,"04bd"))},sortIcon:function(){return n.e("components/sort-icon/sort-icon").then(n.bind(null,"2de9"))},uIcon:function(){return n.e("components/uview-ui/components/u-icon/u-icon").then(n.bind(null,"1340"))},mescrollUni:function(){return Promise.all([n.e("common/vendor"),n.e("components/mescroll-uni/mescroll-uni")]).then(n.bind(null,"01b6"))},goodsCard:function(){return n.e("components/goods-card/goods-card").then(n.bind(null,"4daa"))},uPopup:function(){return n.e("components/uview-ui/components/u-popup/u-popup").then(n.bind(null,"002f"))},uInput:function(){return Promise.all([n.e("common/vendor"),n.e("components/uview-ui/components/u-input/u-input")]).then(n.bind(null,"3012"))}},i=function(){var e=this,t=e.$createElement;e._self._c;e._isMounted||(e.e0=function(t){e.goodsCardStyle="square"},e.e1=function(t){e.goodsCardStyle="rectangle"},e.e2=function(t){e.showScreen=!0}),e.$mp.data=Object.assign({},{$root:{a0:{auto:!0,noMoreSize:10,empty:{icon:"/static/images/empty/shop.png",tip:"没有找到商品~",fixed:!0}}}})},r=[]},df46:function(e,t,n){}},[["0e31","common/runtime","common/vendor"]]]);