list.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. (global.webpackJsonp = global.webpackJsonp || []).push([ [ "pages/product/list" ], {
  2. 258: function(e, t, n) {
  3. (function(e) {
  4. function t(e) {
  5. return e && e.__esModule ? e : {
  6. default: e
  7. };
  8. }
  9. n(4), t(n(2)), e(t(n(259)).default);
  10. }).call(this, n(1).createPage);
  11. },
  12. 259: function(e, t, n) {
  13. n.r(t);
  14. var o = n(260), r = n(262);
  15. for (var a in r) "default" !== a && function(e) {
  16. n.d(t, e, function() {
  17. return r[e];
  18. });
  19. }(a);
  20. n(264);
  21. var i = n(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/list.vue", t.default = c.exports;
  23. },
  24. 260: function(e, t, n) {
  25. n.r(t);
  26. var o = n(261);
  27. n.d(t, "render", function() {
  28. return o.render;
  29. }), n.d(t, "staticRenderFns", function() {
  30. return o.staticRenderFns;
  31. }), n.d(t, "recyclableRender", function() {
  32. return o.recyclableRender;
  33. }), n.d(t, "components", function() {
  34. return o.components;
  35. });
  36. },
  37. 261: function(e, t, n) {
  38. var o;
  39. n.r(t), n.d(t, "render", function() {
  40. return r;
  41. }), n.d(t, "staticRenderFns", function() {
  42. return i;
  43. }), n.d(t, "recyclableRender", function() {
  44. return a;
  45. }), n.d(t, "components", function() {
  46. return o;
  47. });
  48. try {
  49. o = {
  50. uniLoadMore: function() {
  51. return n.e("components/uni-load-more/uni-load-more").then(n.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. 262: function(e, t, n) {
  67. n.r(t);
  68. var o = n(263), r = n.n(o);
  69. for (var a in o) "default" !== a && function(e) {
  70. n.d(t, e, function() {
  71. return o[e];
  72. });
  73. }(a);
  74. t.default = r.a;
  75. },
  76. 263: function(e, t, n) {
  77. (function(e) {
  78. function o(e, t, n, o, r, a, i) {
  79. try {
  80. var c = e[a](i), d = c.value;
  81. } catch (e) {
  82. return void n(e);
  83. }
  84. c.done ? t(d) : Promise.resolve(d).then(o, r);
  85. }
  86. function r(e) {
  87. return function() {
  88. var t = this, n = 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(t, n);
  97. i(void 0);
  98. });
  99. };
  100. }
  101. Object.defineProperty(t, "__esModule", {
  102. value: !0
  103. }), t.default = void 0;
  104. var a = function(e) {
  105. return e && e.__esModule ? e : {
  106. default: e
  107. };
  108. }(n(23)), i = n(28), c = {
  109. components: {
  110. uniLoadMore: function() {
  111. n.e("components/uni-load-more/uni-load-more").then(function() {
  112. return resolve(n(413));
  113. }.bind(null, n)).catch(n.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: 0,
  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. this.loadData("refresh");
  140. },
  141. onReachBottom: function() {
  142. this.loadData();
  143. },
  144. methods: {
  145. loadCateList: function(e, t) {
  146. var n = this;
  147. return r(a.default.mark(function t() {
  148. var o;
  149. return a.default.wrap(function(t) {
  150. for (;;) switch (t.prev = t.next) {
  151. case 0:
  152. o = n, (0, i.getCategoryList)({}).then(function(t) {
  153. console.log(t), t.data.forEach(function(t) {
  154. t.id != e || (o.cateList = t.children);
  155. }), console.log(o.cateList);
  156. });
  157. case 2:
  158. case "end":
  159. return t.stop();
  160. }
  161. }, t);
  162. }))();
  163. },
  164. loadData: function() {
  165. var t = arguments, n = 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 = t.length > 0 && void 0 !== t[0] ? t[0] : "add", c = t.length > 1 ? t[1] : void 0,
  172. d = n, 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. "refresh" === r && (d.goodsList = [], d.page = 1), 1 == n.filterIndex && (console.log(d.salesOrder),
  192. s.salesOrder = 1 == d.numberOrder ? "asc" : "desc"), 2 == n.filterIndex && (console.log(d.priceOrder),
  193. s.priceOrder = 1 == d.priceOrder ? "asc" : "desc"), (0, i.getProducts)(s).then(function(t) {
  194. console.log(t.data), d.goodsList = d.goodsList.concat(t.data), d.limit == t.data.length ? (d.page++,
  195. d.loadingType = "more") : d.loadingType = "nomore", "refresh" === r && (1 == c ? e.hideLoading() : e.stopPullDownRefresh());
  196. });
  197. case 15:
  198. case "end":
  199. return o.stop();
  200. }
  201. }, o);
  202. }))();
  203. },
  204. tabClick: function(t) {
  205. 0 === this.filterIndex && this.filterIndex === t || (this.filterIndex = t, 1 === t && (this.numberOrder = 1 === this.numberOrder ? 2 : 1),
  206. 2 === t && (this.priceOrder = 1 === this.priceOrder ? 2 : 1), this.page = 1, e.pageScrollTo({
  207. duration: 300,
  208. scrollTop: 0
  209. }), this.loadData("refresh", 1), e.showLoading({
  210. title: "正在加载"
  211. }));
  212. },
  213. toggleCateMask: function(e) {
  214. var t = this, n = "show" === e ? 10 : 300, o = "show" === e ? 1 : 0;
  215. this.cateMaskState = 2, setTimeout(function() {
  216. t.cateMaskState = o;
  217. }, n);
  218. },
  219. changeCate: function(t) {
  220. this.cateId = t.id, this.toggleCateMask(), e.pageScrollTo({
  221. duration: 300,
  222. scrollTop: 0
  223. }), this.page = 1, this.loadData("refresh", 1), e.showLoading({
  224. title: "正在加载"
  225. });
  226. },
  227. navToDetailPage: function(t) {
  228. var n = t.id;
  229. e.navigateTo({
  230. url: "/pages/product/product?id=".concat(n)
  231. });
  232. },
  233. stopPrevent: function() {}
  234. }
  235. };
  236. t.default = c;
  237. }).call(this, n(1).default);
  238. },
  239. 264: function(e, t, n) {
  240. n.r(t);
  241. var o = n(265), r = n.n(o);
  242. for (var a in o) "default" !== a && function(e) {
  243. n.d(t, e, function() {
  244. return o[e];
  245. });
  246. }(a);
  247. t.default = r.a;
  248. },
  249. 265: function(e, t, n) {}
  250. }, [ [ 258, "common/runtime", "common/vendor" ] ] ]);