1 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/subPackages/home/search"],{"0d65":function(t,e,o){"use strict";var i=o("7303"),s=o.n(i);s.a},"244a":function(t,e,o){"use strict";o.r(e);var i=o("8594"),s=o.n(i);for(var n in i)["default"].indexOf(n)<0&&function(t){o.d(e,t,(function(){return i[t]}))}(n);e["default"]=s.a},7303:function(t,e,o){},8594:function(t,e,o){"use strict";(function(t){var i=o("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var s=i(o("7eb4")),n=i(o("ee10")),r=i(o("af34")),a=getApp(),c={components:{horizontalGood:function(){o.e("components/horizontalGood").then(function(){return resolve(o("302c"))}.bind(null,o)).catch(o.oe)},topHang:function(){o.e("components/tophang").then(function(){return resolve(o("ff4c"))}.bind(null,o)).catch(o.oe)}},data:function(){return{isIphoneX:a.globalData.isIphoneX,background:{backgroundImage:"transparent"},hotKeywordList:[],historyKeywordList:[],adviceKeywordList:[],scrollView:{height:800,scrollTop:0},haoGoodsList:[],goodsList:[],isShowGoodsList:!1,filter:{loading:!1,hasNext:!0,page:1,keyword:"",sort:1,is_has_coupon:0},user_level:t.getStorageSync("userInfo")?t.getStorageSync("userInfo").user_level:"",goTop_show:!1,tabList:[{type:0,name:"全部"},{type:1,name:"淘宝"},{type:4,name:"拼多多"}],tabsCur:{index:0,type:0}}},computed:{isShowAdvice:function(){return this.filter.keyword&&this.adviceKeywordList&&this.adviceKeywordList.length},isShowHot:function(){return!this.isShowAdvice&&!this.isShowGoodsList},isShowHistory:function(){return!this.isShowAdvice&&!this.isShowGoodsList}},onLoad:function(t){if(t.type){var e="",o=this.tabList.filter((function(o,i){return o.type==t.type&&(e=i),o.type==t.type}));o.length>0&&(this.tabsCur.index=e,this.tabsCur.type=o[0].type)}t.keyword&&(this.filter.keyword=t.keyword,this.onClickSearch()),this.handleGetHotKeywordList(),this.handleGetHistoryKeywordList()},onReachBottom:function(){console.log("onReachBottom => ")},methods:{onChangeTab:function(t){this.tabsCur.index=t,this.tabsCur.type=this.tabList[t].type,this.filter.keyword.trim()&&(this.isShowGoodsList=!0,this.filter.hasNext=!0,this.filter.page=1,this.haoGoodsList=[],this.goodsList=[],this.handleGetGoodsList())},onclickTophang:function(){this.scrollView.scrollTop=0===this.scrollView.scrollTop?-1:0},onScroll:function(t){var e=t.target.scrollTop;this.goTop_show=e>300},handleSetHistoryKeywordList:function(e){if(!e)return!1;var o=t.getStorageSync("historyKeywordList")||[],i=o.findIndex((function(t){return t===e}));-1!==i&&o.splice(i,1),o=[e].concat((0,r.default)(o)),t.setStorageSync("historyKeywordList",o),this.handleGetHistoryKeywordList()},handleGetHistoryKeywordList:function(){try{var e=t.getStorageSync("historyKeywordList")||[];this.historyKeywordList=(0,r.default)(e)}catch(o){this.historyKeywordList=[],console.log("error => ",o)}},handleGetHotKeywordList:function(){var e=this;return(0,n.default)(s.default.mark((function o(){var i,n,a,c,d,h;return s.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:return o.prev=0,t.showLoading({title:"加载中...",mask:!0}),i=e.$api.home_everyoneSearch,n={},a={sex:t.getStorageSync("userInfo")?t.getStorageSync("userInfo").sex:t.getStorageSync("sex")||0},o.next=7,e.$get(i,n,a);case 7:c=o.sent,d=c.data,h=void 0===d?{}:d,h&&0==h.errno&&Array.isArray(h.rst)?e.hotKeywordList=(0,r.default)(h.rst):(e.hotKeywordList=[],t.showToast({title:h.err||"操作失败",icon:"none"})),o.next=17;break;case 13:o.prev=13,o.t0=o["catch"](0),e.hotKeywordList=[],console.log("error => ",o.t0);case 17:return o.prev=17,t.hideLoading(),o.finish(17);case 20:case"end":return o.stop()}}),o,null,[[0,13,17,20]])})))()},handleGetAdviceKeywordList:function(){var e=this;return(0,n.default)(s.default.mark((function o(){var i,n,a,c,d;return s.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:return o.prev=0,t.showLoading({title:"加载中...",mask:!0}),i=e.$api.home_searchAdvice,n={name:e.filter.keyword.trim()},o.next=6,e.$get(i,n);case 6:a=o.sent,c=a.data,d=void 0===c?{}:c,d&&0==d.errno&&Array.isArray(d.rst.data)?e.adviceKeywordList=(0,r.default)(d.rst.data):(e.adviceKeywordList=[],t.showToast({title:d.err||"操作失败",icon:"none"})),o.next=16;break;case 12:o.prev=12,o.t0=o["catch"](0),e.adviceKeywordList=[],console.log("error => ",o.t0);case 16:return o.prev=16,t.hideLoading(),o.finish(16);case 19:case"end":return o.stop()}}),o,null,[[0,12,16,19]])})))()},handleGetGoodsList:function(){var e=this;return(0,n.default)(s.default.mark((function o(){var i,n,a,c,d,h,u,l,f,p,w;return s.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(i=e.filter,n=i.hasNext,a=i.page,c=i.keyword,d=i.sort,h=i.is_has_coupon,n&&!e.filter.loading){o.next=3;break}return o.abrupt("return",!1);case 3:return e.filter.loading=!0,e.handleSetHistoryKeywordList(c),o.prev=5,t.showLoading({title:"加载中...",mask:!0}),u=e.$api_jd.searchV2,l={page:a,keyword:c,sort:d,is_has_coupon:h,type:e.tabsCur.type},o.next=11,e.$postJSON(u,l);case 11:if(f=o.sent,p=f.data,w=void 0===p?{}:p,e.filter.loading=!1,!w||0!=w.errno||!Array.isArray(w.rst.data)){o.next=27;break}return e.filter.hasNext=w.rst.pageInfo.hasNext,e.filter.hasNext&&e.filter.page++,e.goodsList=[].concat((0,r.default)(e.goodsList),(0,r.default)(w.rst.data)),e.haoGoodsList=Array.isArray(w.rst.haoLists)?w.rst.haoLists:[],e.adviceKeywordList=[],e.isShowGoodsList=!0,o.next=24,e.$nextTick();case 24:e.handleInitScrollView(),o.next=28;break;case 27:t.showToast({title:w.err||"操作失败",icon:"none"});case 28:o.next=33;break;case 30:o.prev=30,o.t0=o["catch"](5),console.log("error => ",o.t0);case 33:return o.prev=33,t.hideLoading(),o.finish(33);case 36:case"end":return o.stop()}}),o,null,[[5,30,33,36]])})))()},onInputKeyword:function(t){this.isShowGoodsList=!1,this.filter.hasNext=!0,this.filter.page=1,this.filter.sort=1,this.filter.is_has_coupon=0,this.haoGoodsList=[],this.goodsList=[],this.filter.keyword.trim()?this.$u.debounce(this.handleGetAdviceKeywordList,500):this.adviceKeywordList=[]},onClickClearKeyword:function(){this.filter.keyword="",this.adviceKeywordList=[],this.isShowGoodsList=!1,this.filter.hasNext=!0,this.filter.page=1,this.filter.sort=1,this.filter.is_has_coupon=0,this.haoGoodsList=[],this.goodsList=[]},onClickSearch:function(){this.filter.keyword?(this.isShowGoodsList=!1,this.filter.hasNext=!0,this.filter.page=1,this.filter.sort=1,this.filter.is_has_coupon=0,this.haoGoodsList=[],this.goodsList=[],this.handleGetGoodsList()):t.showToast({title:"请输入搜索关键字",icon:"none"})},onClickHistoryDel:function(){var t=this;return(0,n.default)(s.default.mark((function e(){return s.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t.historyKeywordList&&t.historyKeywordList.length){e.next=2;break}return e.abrupt("return",!1);case 2:return e.next=4,a.handleShowModal("确定清空搜索记录吗?");case 4:t.handleDelKeywordList();case 5:case"end":return e.stop()}}),e)})))()},handleDelKeywordList:function(){var e=this;return(0,n.default)(s.default.mark((function o(){return s.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:t.setStorageSync("historyKeywordList",[]),e.handleGetHistoryKeywordList();case 2:case"end":return o.stop()}}),o)})))()},onClickKeywordItem:function(t){this.filter.keyword=t,this.isShowGoodsList=!1,this.filter.hasNext=!0,this.filter.page=1,this.filter.sort=1,this.filter.is_has_coupon=0,this.haoGoodsList=[],this.goodsList=[],this.handleGetGoodsList()},onClickSort:function(t){var e=t.isPrice,o=void 0!==e&&e,i=t.sort,s=void 0===i?null:i;o?3===this.filter.sort?this.filter.sort=4:(this.filter.sort,this.filter.sort=3):this.filter.sort=s,this.isShowGoodsList=!0,this.filter.hasNext=!0,this.filter.page=1,this.haoGoodsList=[],this.goodsList=[],this.handleGetGoodsList()},onClickIsCoupon:function(){1===this.filter.is_has_coupon?this.filter.is_has_coupon=0:this.filter.is_has_coupon=1,this.isShowGoodsList=!0,this.filter.hasNext=!0,this.filter.page=1,this.haoGoodsList=[],this.goodsList=[],this.handleGetGoodsList()},onScrollToLower:function(t){this.handleGetGoodsList()},handleInitScrollView:function(){var e=this,o=t.getSystemInfoSync().windowHeight,i=t.createSelectorQuery().select(".scroll-view-wrap");i.boundingClientRect((function(t){e.scrollView.height="".concat(o-t.top,"px")})).exec()},onClickGoodsItem:function(e){var o=e.img,i=void 0===o?"":o,s=e.goods_id,n=void 0===s?"":s,r=e.coupon_price,a=void 0===r?"":r,c=e.discount_price,d=void 0===c?"":c,h=e.price,u=void 0===h?"":h,l=e.is_coupon,f=void 0===l?"":l,p=e.commission_rate,w=void 0===p?"":p,y=e.is_high_commission,g=void 0===y?"":y,v=e.coupon_end_time,L=void 0===v?"":v,m=e.coupon_start_time,_=void 0===m?"":m;t.navigateTo({url:"/pages/subPackages/home/goodsDetail?img=".concat(encodeURIComponent(i),"&goods_id=").concat(encodeURIComponent(n),"&coupon_price=").concat(encodeURIComponent(a),"&discount_price=").concat(encodeURIComponent(d),"&price=").concat(encodeURIComponent(u),"&is_coupon=").concat(encodeURIComponent(f),"&commission_rate=").concat(encodeURIComponent(w),"&is_high_commission=").concat(encodeURIComponent(g),"&coupon_end_time=").concat(encodeURIComponent(L),"&coupon_start_time=").concat(encodeURIComponent(_))})}}};e.default=c}).call(this,o("df3c")["default"])},9527:function(t,e,o){"use strict";o.r(e);var i=o("95f4"),s=o("244a");for(var n in s)["default"].indexOf(n)<0&&function(t){o.d(e,t,(function(){return s[t]}))}(n);o("0d65");var r=o("828b"),a=Object(r["a"])(s["default"],i["b"],i["c"],!1,null,"d2a23ed0",null,!1,i["a"],void 0);e["default"]=a.exports},"95f4":function(t,e,o){"use strict";o.d(e,"b",(function(){return s})),o.d(e,"c",(function(){return n})),o.d(e,"a",(function(){return i}));var i={uNavbar:function(){return o.e("node-modules/uview-ui/components/u-navbar/u-navbar").then(o.bind(null,"8fd5"))},uInput:function(){return Promise.all([o.e("common/vendor"),o.e("node-modules/uview-ui/components/u-input/u-input")]).then(o.bind(null,"21a39"))},uTabs:function(){return o.e("node-modules/uview-ui/components/u-tabs/u-tabs").then(o.bind(null,"ebee"))},uEmpty:function(){return o.e("node-modules/uview-ui/components/u-empty/u-empty").then(o.bind(null,"5263"))},uIcon:function(){return o.e("node-modules/uview-ui/components/u-icon/u-icon").then(o.bind(null,"edf6"))},uDivider:function(){return o.e("node-modules/uview-ui/components/u-divider/u-divider").then(o.bind(null,"0f3e"))}},s=function(){var t=this,e=t.$createElement,o=(t._self._c,t.isShowHot?t.hotKeywordList.length:null),i=t.isShowHot?t.hotKeywordList.length:null,s=t.isShowHistory?t.historyKeywordList.length:null,n=t.isShowHistory?t.historyKeywordList.length:null,r=t.isShowGoodsList?t.goodsList&&t.goodsList.length:null,a=t.isShowGoodsList?!t.haoGoodsList.length&&!t.goodsList.length&&!t.filter.loading:null;t.$mp.data=Object.assign({},{$root:{a0:{background:"linear-gradient(90deg, #FF9048 0%, #FB3F3C 100%)","border-radius":"3rpx"},a1:{"font-size":"36rpx","font-weight":"bold"},g0:o,g1:i,g2:s,g3:n,g4:r,g5:a}})},n=[]},bcf5:function(t,e,o){"use strict";(function(t,e){var i=o("47a9");o("1f2f");i(o("3240"));var s=i(o("9527"));t.__webpack_require_UNI_MP_PLUGIN__=o,e(s.default)}).call(this,o("3223")["default"],o("df3c")["createPage"])}},[["bcf5","common/runtime","common/vendor"]]]);
|