goods_explosive.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. <template>
  2. <view class="cate-list">
  3. <mescroll-uni :ref="'mescrollRef'+i" :top="positionTop" @init="mescrollInit"
  4. @down="downCallback" @up="upCallback" :up="upOption" :down="downOption" >
  5. <view class="content">
  6. <view style="margin: 0 20rpx" v-if="appConfig.cate_style == 3">
  7. <cate-nav :list="cateTwoList"></cate-nav>
  8. </view>
  9. <ad-swipers :pid="11" height="268rpx" padding="20rpx 20rpx 0" radius="10rpx">
  10. </ad-swipers>
  11. <view class="sort-nav-wrap">
  12. <sort-nav v-model="sortConfig"></sort-nav>
  13. </view>
  14. <view class="goods">
  15. <view v-show="sortConfig.goodsType == 'double'" class="double">
  16. <goods-list type="double" :list="goodsList"></goods-list>
  17. </view>
  18. <view v-show="sortConfig.goodsType == 'one'" class="one">
  19. <goods-list :list="goodsList" type="one"></goods-list>
  20. </view>
  21. </view>
  22. </view>
  23. </mescroll-uni>
  24. </view>
  25. </template>
  26. <script>
  27. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  28. import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
  29. import {
  30. getGoodsList,
  31. getListByLevelOne
  32. } from "@/api/store"
  33. import {
  34. mapGetters,
  35. mapActions
  36. } from 'vuex'
  37. const app = getApp()
  38. export default {
  39. mixins: [MescrollMixin, MescrollMoreItemMixin],
  40. name: "cate-list",
  41. props: {
  42. top: {
  43. type: [Number, String]
  44. },
  45. cate: {
  46. type: Object,
  47. default: () => ({})
  48. }
  49. },
  50. data() {
  51. return {
  52. goodsList: [],
  53. cateTwoList: [],
  54. upOption: {
  55. auto: false, // 不自动加载
  56. noMoreSize: 1, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  57. empty: {
  58. icon: '/static/images/goods_null.png',
  59. tip: '暂无商品~', // 提示
  60. }
  61. },
  62. sortConfig: {
  63. goodsType: 'double',
  64. priceSort: '',
  65. saleSort: '',
  66. },
  67. };
  68. },
  69. computed: {
  70. ...mapGetters(['appConfig']),
  71. positionTop() {
  72. return this.top
  73. }
  74. },
  75. methods: {
  76. onRefresh() {
  77. this.mescroll.resetUpScroll(true);
  78. },
  79. async downCallback() {
  80. await this.getListByLevelOneFun()
  81. this.mescroll.resetUpScroll();
  82. },
  83. upCallback(page) {
  84. const {sortConfig: {
  85. priceSort,
  86. saleSort,
  87. }} = this
  88. getGoodsList({
  89. page_size: page.size,
  90. page_no: page.num,
  91. platform_cate_id: this.cate.id,
  92. sort_by_price: priceSort,
  93. sort_by_sales: saleSort
  94. }).then(({
  95. data
  96. }) => {
  97. const curPageData = data.lists;
  98. const curPageLen = curPageData.length;
  99. const hasNext = !!data.more;
  100. if (page.num == 1) this.goodsList = [];
  101. this.goodsList = this.goodsList.concat(curPageData);
  102. this.mescroll.endSuccess(curPageLen, hasNext);
  103. })
  104. },
  105. async getListByLevelOneFun() {
  106. const {
  107. id
  108. } = this.cate
  109. const {
  110. code,
  111. data
  112. } = await getListByLevelOne({
  113. id
  114. })
  115. if (code == 1) {
  116. this.cateTwoList = data
  117. }
  118. }
  119. },
  120. watch: {
  121. 'sortConfig.saleSort'() {
  122. this.onRefresh()
  123. },
  124. 'sortConfig.priceSort'() {
  125. this.onRefresh()
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss">
  131. .cate-list {
  132. border-radius: 20rpx 20rpx 0 0;
  133. overflow: hidden;
  134. .contain {
  135. padding: 20rpx 30rpx 0;
  136. }
  137. .sort-nav-wrap {
  138. margin: 20rpx 20rpx 0;
  139. border-radius: 14rpx;
  140. overflow: hidden;
  141. }
  142. .title-img {
  143. width: 100%;
  144. height: 120rpx;
  145. }
  146. }
  147. </style>
  148. <template>
  149. <view class="cate-list">
  150. <mescroll-uni :ref="'mescrollRef'+i" :top="positionTop" @init="mescrollInit"
  151. @down="downCallback" @up="upCallback" :up="upOption" :down="downOption" >
  152. <view class="content">
  153. <view style="margin: 0 20rpx" v-if="appConfig.cate_style == 3">
  154. <cate-nav :list="cateTwoList"></cate-nav>
  155. </view>
  156. <ad-swipers :pid="11" height="268rpx" padding="20rpx 20rpx 0" radius="10rpx">
  157. </ad-swipers>
  158. <view class="sort-nav-wrap">
  159. <sort-nav v-model="sortConfig"></sort-nav>
  160. </view>
  161. <view class="goods">
  162. <view v-show="sortConfig.goodsType == 'double'" class="double">
  163. <goods-list type="double" :list="goodsList"></goods-list>
  164. </view>
  165. <view v-show="sortConfig.goodsType == 'one'" class="one">
  166. <goods-list :list="goodsList" type="one"></goods-list>
  167. </view>
  168. </view>
  169. </view>
  170. </mescroll-uni>
  171. </view>
  172. </template>
  173. <script>
  174. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  175. import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
  176. import {
  177. getGoodsList,
  178. getListByLevelOne
  179. } from "@/api/store"
  180. import {
  181. mapGetters,
  182. mapActions
  183. } from 'vuex'
  184. const app = getApp()
  185. export default {
  186. mixins: [MescrollMixin, MescrollMoreItemMixin],
  187. name: "cate-list",
  188. props: {
  189. top: {
  190. type: [Number, String]
  191. },
  192. cate: {
  193. type: Object,
  194. default: () => ({})
  195. }
  196. },
  197. data() {
  198. return {
  199. goodsList: [],
  200. cateTwoList: [],
  201. upOption: {
  202. auto: false, // 不自动加载
  203. noMoreSize: 1, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  204. empty: {
  205. icon: '/static/images/goods_null.png',
  206. tip: '暂无商品~', // 提示
  207. }
  208. },
  209. sortConfig: {
  210. goodsType: 'double',
  211. priceSort: '',
  212. saleSort: '',
  213. },
  214. };
  215. },
  216. computed: {
  217. ...mapGetters(['appConfig']),
  218. positionTop() {
  219. return this.top
  220. }
  221. },
  222. methods: {
  223. onRefresh() {
  224. this.mescroll.resetUpScroll(true);
  225. },
  226. async downCallback() {
  227. await this.getListByLevelOneFun()
  228. this.mescroll.resetUpScroll();
  229. },
  230. upCallback(page) {
  231. const {sortConfig: {
  232. priceSort,
  233. saleSort,
  234. }} = this
  235. getGoodsList({
  236. page_size: page.size,
  237. page_no: page.num,
  238. platform_cate_id: this.cate.id,
  239. sort_by_price: priceSort,
  240. sort_by_sales: saleSort
  241. }).then(({
  242. data
  243. }) => {
  244. const curPageData = data.lists;
  245. const curPageLen = curPageData.length;
  246. const hasNext = !!data.more;
  247. if (page.num == 1) this.goodsList = [];
  248. this.goodsList = this.goodsList.concat(curPageData);
  249. this.mescroll.endSuccess(curPageLen, hasNext);
  250. })
  251. },
  252. async getListByLevelOneFun() {
  253. const {
  254. id
  255. } = this.cate
  256. const {
  257. code,
  258. data
  259. } = await getListByLevelOne({
  260. id
  261. })
  262. if (code == 1) {
  263. this.cateTwoList = data
  264. }
  265. }
  266. },
  267. watch: {
  268. 'sortConfig.saleSort'() {
  269. this.onRefresh()
  270. },
  271. 'sortConfig.priceSort'() {
  272. this.onRefresh()
  273. }
  274. }
  275. }
  276. </script>
  277. <style lang="scss">
  278. .cate-list {
  279. border-radius: 20rpx 20rpx 0 0;
  280. overflow: hidden;
  281. .contain {
  282. padding: 20rpx 30rpx 0;
  283. }
  284. .sort-nav-wrap {
  285. margin: 20rpx 20rpx 0;
  286. border-radius: 14rpx;
  287. overflow: hidden;
  288. }
  289. .title-img {
  290. width: 100%;
  291. height: 120rpx;
  292. }
  293. }
  294. </style>
  295. <template>
  296. <view class="cate-list">
  297. <mescroll-uni :ref="'mescrollRef'+i" :top="positionTop" @init="mescrollInit"
  298. @down="downCallback" @up="upCallback" :up="upOption" :down="downOption" >
  299. <view class="content">
  300. <view style="margin: 0 20rpx" v-if="appConfig.cate_style == 3">
  301. <cate-nav :list="cateTwoList"></cate-nav>
  302. </view>
  303. <ad-swipers :pid="11" height="268rpx" padding="20rpx 20rpx 0" radius="10rpx">
  304. </ad-swipers>
  305. <view class="sort-nav-wrap">
  306. <sort-nav v-model="sortConfig"></sort-nav>
  307. </view>
  308. <view class="goods">
  309. <view v-show="sortConfig.goodsType == 'double'" class="double">
  310. <goods-list type="double" :list="goodsList"></goods-list>
  311. </view>
  312. <view v-show="sortConfig.goodsType == 'one'" class="one">
  313. <goods-list :list="goodsList" type="one"></goods-list>
  314. </view>
  315. </view>
  316. </view>
  317. </mescroll-uni>
  318. </view>
  319. </template>
  320. <script>
  321. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  322. import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
  323. import {
  324. getGoodsList,
  325. getListByLevelOne
  326. } from "@/api/store"
  327. import {
  328. mapGetters,
  329. mapActions
  330. } from 'vuex'
  331. const app = getApp()
  332. export default {
  333. mixins: [MescrollMixin, MescrollMoreItemMixin],
  334. name: "cate-list",
  335. props: {
  336. top: {
  337. type: [Number, String]
  338. },
  339. cate: {
  340. type: Object,
  341. default: () => ({})
  342. }
  343. },
  344. data() {
  345. return {
  346. goodsList: [],
  347. cateTwoList: [],
  348. upOption: {
  349. auto: false, // 不自动加载
  350. noMoreSize: 1, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  351. empty: {
  352. icon: '/static/images/goods_null.png',
  353. tip: '暂无商品~', // 提示
  354. }
  355. },
  356. sortConfig: {
  357. goodsType: 'double',
  358. priceSort: '',
  359. saleSort: '',
  360. },
  361. };
  362. },
  363. computed: {
  364. ...mapGetters(['appConfig']),
  365. positionTop() {
  366. return this.top
  367. }
  368. },
  369. methods: {
  370. onRefresh() {
  371. this.mescroll.resetUpScroll(true);
  372. },
  373. async downCallback() {
  374. await this.getListByLevelOneFun()
  375. this.mescroll.resetUpScroll();
  376. },
  377. upCallback(page) {
  378. const {sortConfig: {
  379. priceSort,
  380. saleSort,
  381. }} = this
  382. getGoodsList({
  383. page_size: page.size,
  384. page_no: page.num,
  385. platform_cate_id: this.cate.id,
  386. sort_by_price: priceSort,
  387. sort_by_sales: saleSort
  388. }).then(({
  389. data
  390. }) => {
  391. const curPageData = data.lists;
  392. const curPageLen = curPageData.length;
  393. const hasNext = !!data.more;
  394. if (page.num == 1) this.goodsList = [];
  395. this.goodsList = this.goodsList.concat(curPageData);
  396. this.mescroll.endSuccess(curPageLen, hasNext);
  397. })
  398. },
  399. async getListByLevelOneFun() {
  400. const {
  401. id
  402. } = this.cate
  403. const {
  404. code,
  405. data
  406. } = await getListByLevelOne({
  407. id
  408. })
  409. if (code == 1) {
  410. this.cateTwoList = data
  411. }
  412. }
  413. },
  414. watch: {
  415. 'sortConfig.saleSort'() {
  416. this.onRefresh()
  417. },
  418. 'sortConfig.priceSort'() {
  419. this.onRefresh()
  420. }
  421. }
  422. }
  423. </script>
  424. <style lang="scss">
  425. .cate-list {
  426. border-radius: 20rpx 20rpx 0 0;
  427. overflow: hidden;
  428. .contain {
  429. padding: 20rpx 30rpx 0;
  430. }
  431. .sort-nav-wrap {
  432. margin: 20rpx 20rpx 0;
  433. border-radius: 14rpx;
  434. overflow: hidden;
  435. }
  436. .title-img {
  437. width: 100%;
  438. height: 120rpx;
  439. }
  440. }
  441. </style>
  442. <template>
  443. <view class="cate-list">
  444. <mescroll-uni :ref="'mescrollRef'+i" :top="positionTop" @init="mescrollInit"
  445. @down="downCallback" @up="upCallback" :up="upOption" :down="downOption" >
  446. <view class="content">
  447. <view style="margin: 0 20rpx" v-if="appConfig.cate_style == 3">
  448. <cate-nav :list="cateTwoList"></cate-nav>
  449. </view>
  450. <ad-swipers :pid="11" height="268rpx" padding="20rpx 20rpx 0" radius="10rpx">
  451. </ad-swipers>
  452. <view class="sort-nav-wrap">
  453. <sort-nav v-model="sortConfig"></sort-nav>
  454. </view>
  455. <view class="goods">
  456. <view v-show="sortConfig.goodsType == 'double'" class="double">
  457. <goods-list type="double" :list="goodsList"></goods-list>
  458. </view>
  459. <view v-show="sortConfig.goodsType == 'one'" class="one">
  460. <goods-list :list="goodsList" type="one"></goods-list>
  461. </view>
  462. </view>
  463. </view>
  464. </mescroll-uni>
  465. </view>
  466. </template>
  467. <script>
  468. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  469. import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
  470. import {
  471. getGoodsList,
  472. getListByLevelOne
  473. } from "@/api/store"
  474. import {
  475. mapGetters,
  476. mapActions
  477. } from 'vuex'
  478. const app = getApp()
  479. export default {
  480. mixins: [MescrollMixin, MescrollMoreItemMixin],
  481. name: "cate-list",
  482. props: {
  483. top: {
  484. type: [Number, String]
  485. },
  486. cate: {
  487. type: Object,
  488. default: () => ({})
  489. }
  490. },
  491. data() {
  492. return {
  493. goodsList: [],
  494. cateTwoList: [],
  495. upOption: {
  496. auto: true, // 不自动加载
  497. noMoreSize: 1, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  498. empty: {
  499. icon: '/static/images/goods_null.png',
  500. tip: '暂无商品~', // 提示
  501. }
  502. },
  503. sortConfig: {
  504. goodsType: 'double',
  505. priceSort: '',
  506. saleSort: '',
  507. },
  508. };
  509. },
  510. computed: {
  511. ...mapGetters(['appConfig']),
  512. positionTop() {
  513. return this.top
  514. }
  515. },
  516. methods: {
  517. onRefresh() {
  518. this.mescroll.resetUpScroll(true);
  519. },
  520. async downCallback() {
  521. await this.getListByLevelOneFun()
  522. this.mescroll.resetUpScroll();
  523. },
  524. upCallback(page) {
  525. const {sortConfig: {
  526. priceSort,
  527. saleSort,
  528. }} = this
  529. getGoodsList({
  530. page_size: page.size,
  531. page_no: page.num,
  532. platform_cate_id: 8,
  533. sort_by_price: priceSort,
  534. sort_by_sales: saleSort
  535. }).then(({
  536. data
  537. }) => {
  538. const curPageData = data.lists;
  539. const curPageLen = curPageData.length;
  540. const hasNext = !!data.more;
  541. if (page.num == 1) this.goodsList = [];
  542. this.goodsList = this.goodsList.concat(curPageData);
  543. this.mescroll.endSuccess(curPageLen, hasNext);
  544. })
  545. },
  546. async getListByLevelOneFun() {
  547. const {
  548. id
  549. } = this.cate
  550. const {
  551. code,
  552. data
  553. } = await getListByLevelOne({
  554. id
  555. })
  556. if (code == 1) {
  557. this.cateTwoList = data
  558. }
  559. }
  560. },
  561. watch: {
  562. 'sortConfig.saleSort'() {
  563. this.onRefresh()
  564. },
  565. 'sortConfig.priceSort'() {
  566. this.onRefresh()
  567. }
  568. }
  569. }
  570. </script>
  571. <style lang="scss">
  572. .cate-list {
  573. border-radius: 20rpx 20rpx 0 0;
  574. overflow: hidden;
  575. .contain {
  576. padding: 20rpx 30rpx 0;
  577. }
  578. .sort-nav-wrap {
  579. margin: 20rpx 20rpx 0;
  580. border-radius: 14rpx;
  581. overflow: hidden;
  582. }
  583. .title-img {
  584. width: 100%;
  585. height: 120rpx;
  586. }
  587. }
  588. </style>