listSearch.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. (global.webpackJsonp = global.webpackJsonp || []).push([ [ "pages/product/listSearch" ], {
  2. 266: function(e, n, t) {
  3. (function(e) {
  4. function n(e) {
  5. return e && e.__esModule ? e : {
  6. default: e
  7. };
  8. }
  9. t(4), n(t(2)), e(n(t(267)).default);
  10. }).call(this, t(1).createPage);
  11. },
  12. 267: function(e, n, t) {
  13. t.r(n);
  14. var o = t(268), r = t(270);
  15. for (var a in r) "default" !== a && function(e) {
  16. t.d(n, e, function() {
  17. return r[e];
  18. });
  19. }(a);
  20. t(273);
  21. var i = t(13), c = Object(i.default)(r.default, o.render, o.staticRenderFns, !1, null, null, null, !1, o.components, void 0);
  22. c.options.__file = "pages/product/listSearch.vue", n.default = c.exports;
  23. },
  24. 268: function(e, n, t) {
  25. t.r(n);
  26. var o = t(269);
  27. t.d(n, "render", function() {
  28. return o.render;
  29. }), t.d(n, "staticRenderFns", function() {
  30. return o.staticRenderFns;
  31. }), t.d(n, "recyclableRender", function() {
  32. return o.recyclableRender;
  33. }), t.d(n, "components", function() {
  34. return o.components;
  35. });
  36. },
  37. 269: function(e, n, t) {
  38. var o;
  39. t.r(n), t.d(n, "render", function() {
  40. return r;
  41. }), t.d(n, "staticRenderFns", function() {
  42. return i;
  43. }), t.d(n, "recyclableRender", function() {
  44. return a;
  45. }), t.d(n, "components", function() {
  46. return o;
  47. });
  48. try {
  49. o = {
  50. uniLoadMore: function() {
  51. return t.e("components/uni-load-more/uni-load-more").then(t.bind(null, 413));
  52. }
  53. };
  54. } catch (e) {
  55. if (-1 === e.message.indexOf("Cannot find module") || -1 === e.message.indexOf(".vue")) throw e;
  56. console.error(e.message), console.error("1. 排查组件名称拼写是否正确"), console.error("2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),
  57. console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件");
  58. }
  59. var r = function() {
  60. var e = this;
  61. e.$createElement;
  62. e._self._c;
  63. }, a = !1, i = [];
  64. r._withStripped = !0;
  65. },
  66. 270: function(e, n, t) {
  67. t.r(n);
  68. var o = t(271), r = t.n(o);
  69. for (var a in o) "default" !== a && function(e) {
  70. t.d(n, e, function() {
  71. return o[e];
  72. });
  73. }(a);
  74. n.default = r.a;
  75. },
  76. 271: function(e, n, t) {
  77. (function(e) {
  78. function o(e, n, t, o, r, a, i) {
  79. try {
  80. var c = e[a](i), d = c.value;
  81. } catch (e) {
  82. return void t(e);
  83. }
  84. c.done ? n(d) : Promise.resolve(d).then(o, r);
  85. }
  86. function r(e) {
  87. return function() {
  88. var n = this, t = arguments;
  89. return new Promise(function(r, a) {
  90. function i(e) {
  91. o(d, r, a, i, c, "next", e);
  92. }
  93. function c(e) {
  94. o(d, r, a, i, c, "throw", e);
  95. }
  96. var d = e.apply(n, t);
  97. i(void 0);
  98. });
  99. };
  100. }
  101. Object.defineProperty(n, "__esModule", {
  102. value: !0
  103. }), n.default = void 0;
  104. var a = function(e) {
  105. return e && e.__esModule ? e : {
  106. default: e
  107. };
  108. }(t(23)), i = t(28), c = t(272), d = {
  109. components: {
  110. uniLoadMore: function() {
  111. t.e("components/uni-load-more/uni-load-more").then(function() {
  112. return resolve(t(413));
  113. }.bind(null, t)).catch(t.oe);
  114. }
  115. },
  116. data: function() {
  117. return {
  118. cateMaskState: 0,
  119. headerPosition: "fixed",
  120. headerTop: "0px",
  121. loadingType: "more",
  122. filterIndex: 0,
  123. numberOrder: 0,
  124. limit: 6,
  125. page: 1,
  126. cateId: 0,
  127. priceOrder: 0,
  128. cateList: [],
  129. goodsList: []
  130. };
  131. },
  132. onLoad: function(e) {
  133. this.cateId = e.tid, this.loadCateList(e.fid, e.sid), this.loadData();
  134. },
  135. onPageScroll: function(e) {
  136. e.scrollTop >= 0 ? this.headerPosition = "fixed" : this.headerPosition = "absolute";
  137. },
  138. onPullDownRefresh: function() {
  139. console.log("下拉刷新"), this.loadData("refresh");
  140. },
  141. onReachBottom: function() {
  142. this.loadData();
  143. },
  144. methods: {
  145. loadCateList: function(e, n) {
  146. var t = this;
  147. return r(a.default.mark(function n() {
  148. var o;
  149. return a.default.wrap(function(n) {
  150. for (;;) switch (n.prev = n.next) {
  151. case 0:
  152. o = t, (0, c.getList)({}).then(function(n) {
  153. console.log(n), n.data.forEach(function(n) {
  154. n.id != e || (o.cateList = n.children);
  155. }), console.log(o.cateList);
  156. });
  157. case 2:
  158. case "end":
  159. return n.stop();
  160. }
  161. }, n);
  162. }))();
  163. },
  164. loadData: function() {
  165. var n = arguments, t = this;
  166. return r(a.default.mark(function o() {
  167. var r, c, d, s;
  168. return a.default.wrap(function(o) {
  169. for (;;) switch (o.prev = o.next) {
  170. case 0:
  171. if (r = n.length > 0 && void 0 !== n[0] ? n[0] : "add", c = n.length > 1 ? n[1] : void 0,
  172. d = t, s = {
  173. page: d.page,
  174. limit: d.limit,
  175. sid: d.cateId
  176. }, "add" !== r) {
  177. o.next = 10;
  178. break;
  179. }
  180. if ("nomore" !== d.loadingType) {
  181. o.next = 7;
  182. break;
  183. }
  184. return o.abrupt("return");
  185. case 7:
  186. d.loadingType = "loading", o.next = 11;
  187. break;
  188. case 10:
  189. d.loadingType = "more";
  190. case 11:
  191. 1 == t.filterIndex && (console.log(d.salesOrder), s.salesOrder = 1 == d.numberOrder ? "asc" : "desc"),
  192. 2 == t.filterIndex && (console.log(d.priceOrder), s.priceOrder = 1 == d.priceOrder ? "asc" : "desc"),
  193. (0, i.getProducts)(s).then(function(n) {
  194. "refresh" === r && (console.log("jinru"), d.goodsList = []), console.log(n.data),
  195. d.goodsList = d.goodsList.concat(n.data), d.limit == n.data.length ? (d.page++,
  196. d.loadingType = "more") : d.loadingType = "nomore", "refresh" === r && (1 == c ? e.hideLoading() : e.stopPullDownRefresh());
  197. });
  198. case 14:
  199. case "end":
  200. return o.stop();
  201. }
  202. }, o);
  203. }))();
  204. },
  205. tabClick: function(n) {
  206. 0 === this.filterIndex && this.filterIndex === n || (this.filterIndex = n, 1 === n && (this.numberOrder = 1 === this.numberOrder ? 2 : 1),
  207. 2 === n && (this.priceOrder = 1 === this.priceOrder ? 2 : 1), this.page = 1, e.pageScrollTo({
  208. duration: 300,
  209. scrollTop: 0
  210. }), this.loadData("refresh", 1), e.showLoading({
  211. title: "正在加载"
  212. }));
  213. },
  214. toggleCateMask: function(e) {
  215. var n = this, t = "show" === e ? 10 : 300, o = "show" === e ? 1 : 0;
  216. this.cateMaskState = 2, setTimeout(function() {
  217. n.cateMaskState = o;
  218. }, t);
  219. },
  220. changeCate: function(n) {
  221. this.cateId = n.id, this.toggleCateMask(), e.pageScrollTo({
  222. duration: 300,
  223. scrollTop: 0
  224. }), this.loadData("refresh", 1), e.showLoading({
  225. title: "正在加载"
  226. });
  227. },
  228. navToDetailPage: function(n) {
  229. var t = n.id;
  230. e.navigateTo({
  231. url: "/pages/product/product?id=".concat(t)
  232. });
  233. },
  234. stopPrevent: function() {}
  235. }
  236. };
  237. n.default = d;
  238. }).call(this, t(1).default);
  239. },
  240. 273: function(e, n, t) {
  241. t.r(n);
  242. var o = t(274), r = t.n(o);
  243. for (var a in o) "default" !== a && function(e) {
  244. t.d(n, e, function() {
  245. return o[e];
  246. });
  247. }(a);
  248. n.default = r.a;
  249. },
  250. 274: function(e, n, t) {}
  251. }, [ [ 266, "common/runtime", "common/vendor" ] ] ]);