You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
high-mini/unpackage/dist/build/mp-weixin/pages/goods/HM-search/HM-search.js

1 line
3.8 KiB

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/goods/HM-search/HM-search"],{"2b54":function(t,e,o){"use strict";o.r(e);var i=o("917d"),n=o.n(i);for(var a in i)"default"!==a&&function(t){o.d(e,t,(function(){return i[t]}))}(a);e["default"]=n.a},7126:function(t,e,o){"use strict";(function(t){o("eba6");i(o("66fd"));var e=i(o("c48b"));function i(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,o("543d")["createPage"])},"917d":function(t,e,o){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=o("b528"),n=getApp(),a=function(){o.e("components/mehaotian-search-revision/mehaotian-search-revision").then(function(){return resolve(o("2522"))}.bind(null,o)).catch(o.oe)},r={data:function(){return{defaultKeyword:"",keyword:"",oldKeywordList:[],hotKeywordList:[],keywordList:[],forbid:"",isShowKeywordList:!1,imageUrl:n.globalData.imgUrl,productList:[],pageNum:1,pageSize:10,isNoMoreData:!1,loadingText:""}},onLoad:function(){this.init()},components:{mSearch:a},onReachBottom:function(){this.getCouponList()},methods:{toGoods:function(e){t.navigateTo({url:"../../goods/goods?id="+e})},getCouponList:function(){var e=this;if(t.showLoading({title:"加载中..."}),this.isNoMoreData)return t.hideLoading(),this.loadingText="到底了",!1;var o=this.pageNum,a={regionId:n.globalData.cityId,pageNum:o,couponName:this.keyword,pageSize:this.pageSize};(0,i.getCouponList)(a).then((function(i){"000000"==i.return_code?(t.hideLoading(),e.isNoMoreData=i.return_data.list.length!=e.pageSize,e.productList=e.productList.concat(i.return_data.list),i.return_data.total==e.pageNum*e.pageSize&&(e.isNoMoreData=!0),e.pageNum=i.return_data.list.length==e.pageSize?++o:o):(e.productList=[],t.hideLoading())}))},init:function(){this.loadDefaultKeyword()},blur:function(){t.hideKeyboard()},loadDefaultKeyword:function(){this.defaultKeyword="默认关键字"},loadOldKeyword:function(){var e=this;t.getStorage({key:"OldKeys",success:function(t){var o=JSON.parse(t.data);e.oldKeywordList=o}})},inputChange:function(t){var e=t.detail?t.detail.value:t;if(!e)return this.keywordList=[],void(this.isShowKeywordList=!1);this.isShowKeywordList=!0,this.getCouponList()},drawCorrelativeKeyword:function(t,e){for(var o=t.length,i=[],n=0;n<o;n++){var a=t[n],r=a[0].replace(e,"<span style='color: #9f9f9f;'>"+e+"</span>");r="<div>"+r+"</div>";var s={keyword:a[0],htmlStr:r};i.push(s)}return i},setKeyword:function(t){this.keyword=this.keywordList[t].keyword},oldDelete:function(){var e=this;t.showModal({content:"确定清除历史搜索记录?",success:function(o){o.confirm?(console.log("用户点击确定"),e.oldKeywordList=[],t.removeStorage({key:"OldKeys"})):o.cancel&&console.log("用户点击取消")}})},hotToggle:function(){this.forbid=this.forbid?"":"_forbid"},doSearch:function(t){t=!1===t?this.keyword:t,this.keyword=t,this.pageNum=1,this.getCouponList()},saveKeyword:function(e){var o=this;t.getStorage({key:"OldKeys",success:function(i){var n=JSON.parse(i.data),a=n.indexOf(e);-1==a||n.splice(a,1),n.unshift(e),n.length>10&&n.pop(),t.setStorage({key:"OldKeys",data:JSON.stringify(n)}),o.oldKeywordList=n},fail:function(i){var n=[e];t.setStorage({key:"OldKeys",data:JSON.stringify(n)}),o.oldKeywordList=n}})}}};e.default=r}).call(this,o("543d")["default"])},"976b":function(t,e,o){"use strict";var i=o("c1df"),n=o.n(i);n.a},bddb:function(t,e,o){"use strict";var i;o.d(e,"b",(function(){return n})),o.d(e,"c",(function(){return a})),o.d(e,"a",(function(){return i}));var n=function(){var t=this,e=t.$createElement;t._self._c},a=[]},c1df:function(t,e,o){},c48b:function(t,e,o){"use strict";o.r(e);var i=o("bddb"),n=o("2b54");for(var a in n)"default"!==a&&function(t){o.d(e,t,(function(){return n[t]}))}(a);o("976b");var r,s=o("f0c5"),d=Object(s["a"])(n["default"],i["b"],i["c"],!1,null,null,null,!1,i["a"],r);e["default"]=d.exports}},[["7126","common/runtime","common/vendor"]]]);