search.js 5.1 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/pick/search/search"],{"06b8":function(t,e,r){"use strict";(function(t){r("2d0a");n(r("66fd"));var e=n(r("9868"));function n(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,r("543d")["createPage"])},2551:function(t,e,r){"use strict";var n=r("c11a"),i=r.n(n);i.a},"6b2f":function(t,e,r){"use strict";r.r(e);var n=r("cdf1"),i=r.n(n);for(var o in n)"default"!==o&&function(t){r.d(e,t,(function(){return n[t]}))}(o);e["default"]=i.a},9868:function(t,e,r){"use strict";r.r(e);var n=r("fbab"),i=r("6b2f");for(var o in i)"default"!==o&&function(t){r.d(e,t,(function(){return i[t]}))}(o);r("2551");var a,c=r("f0c5"),s=Object(c["a"])(i["default"],n["b"],n["c"],!1,null,"2a6c5195",null,!1,n["a"],a);e["default"]=s.exports},c11a:function(t,e,r){},cdf1:function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=o(r("a34a")),i=r("2f62");function o(t){return t&&t.__esModule?t:{default:t}}function a(t){return f(t)||u(t)||s(t)||c()}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(t,e){if(t){if("string"===typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}function u(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function f(t){if(Array.isArray(t))return l(t)}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function d(t,e,r,n,i,o,a){try{var c=t[o](a),s=c.value}catch(u){return void r(u)}c.done?e(s):Promise.resolve(s).then(n,i)}function h(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){d(o,n,i,a,c,"next",t)}function c(t){d(o,n,i,a,c,"throw",t)}a(void 0)}))}}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){g(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function g(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var m={name:"search",data:function(){return{list:[],keyword:"",activity:{},historyList:[],isSearch:!1,page:1}},onLoad:function(){this.$commonLoad.onload(),this.historyList=this.getHistory()},computed:y(y({},(0,i.mapState)({appImg:function(t){return t.mallConfig.__wxapp_img.mall},appSetting:function(t){return t.mallConfig.mall.setting}})),(0,i.mapGetters)("mallConfig",{getTheme:"getTheme"})),onReachBottom:function(){this.page++,this.getList()},methods:{navigator:function(e){t.navigateTo({url:e})},search:function(){var t=this.keyword;""!==t&&(this.keyword=t.trim(),this.reset())},reset:function(){this.page=1,this.getGoodsList()},getList:function(){var t=this;return h(n.default.mark((function e(){var r,i,o;return n.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.$request({url:t.$api.pick.goods_list,method:"get",data:{keyword:t.keyword,page:t.page}});case 2:r=e.sent,0===r.code&&(o=r.data.list,(i=t.list).push.apply(i,a(o)));case 4:case"end":return e.stop()}}),e)})))()},getGoodsList:function(){var t=this;return h(n.default.mark((function e(){var r,i,o,a,c,s;return n.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.$request({url:t.$api.pick.goods_list,method:"get",data:{keyword:t.keyword,page:t.page}});case 2:r=e.sent,0===r.code&&(i=r.data,o=i.bg_url,a=i.list,c=i.form,s=i.activity,t.isSearch=!0,t.list=a,t.background=o,t.form=c,t.activity=s,t.setHistory());case 4:case"end":return e.stop()}}),e)})))()},setHistory:function(){var t=this.getHistory(),e=this.keyword.trim();t.forEach((function(r,n){r.keyword===e&&t.splice(n,1)})),t.push({keyword:e}),t.length>20&&t.shift(),this.historyList=t,this.$storage.setStorageSync("SEARCH_HISTORY_LIST",t)},getHistory:function(){var t=this.$storage.getStorageSync("SEARCH_HISTORY_LIST");return t||(t=[]),t},deleteHistory:function(){this.$storage.removeStorageSync("SEARCH_HISTORY_LIST"),this.historyList=[]},cancel:function(){this.isSearch=!1,this.keyword="",this.list=[]},historyClick:function(t){this.keyword=t.trim(),this.reset()},deleteKeyword:function(){this.keyword=""}},watch:{keyword:{handler:function(t){""==t&&this.cancel()},immediate:!0}}};e.default=m}).call(this,r("543d")["default"])},fbab:function(t,e,r){"use strict";var n;r.d(e,"b",(function(){return i})),r.d(e,"c",(function(){return o})),r.d(e,"a",(function(){return n}));var i=function(){var t=this,e=t.$createElement;t._self._c},o=[]}},[["06b8","common/runtime","common/vendor"]]]);