list.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view>
  3. <view class="search">
  4. <u-search placeholder="搜索商品名称" v-model="param.customerName" bgColor="white" @search="refresh()" :animation="true" actionText="取消" @clear="refresh()"></u-search>
  5. <view class="clear"></view>
  6. </view>
  7. <view class="goodsList">
  8. <view class="sort-list">
  9. <view class="sort-item" :class="{ active: item.check }" v-for="(item, index) in sort" :key="index" @click="select(item, index)">
  10. <text>{{ item.name }}</text>
  11. <text v-if="index > 0 && item.isAsc == 'desc'" class="icon">&#xeb0a;</text>
  12. <text v-if="index > 0 && item.isAsc == 'asc'" class="icon">&#xeb0b;</text>
  13. </view>
  14. <view class="type" @click="show = true">
  15. <text>分类</text>
  16. <text class="icon">&#xe8f2;</text>
  17. </view>
  18. <view class="clear"></view>
  19. </view>
  20. <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
  21. <view class="title">广西京东自营店南宁分店</view>
  22. <image src="../../../static/news.jpg" mode="aspectFill" class="pic"></image>
  23. <view class="con">
  24. <view class="productName omit">八角茴香(未磨)(可食用)</view>
  25. <view class="desc">50吨</view>
  26. <view class="price">¥ 5000</view>
  27. <view class="icon buy" v-if="user.userType == 2">&#xe604;</view>
  28. </view>
  29. <view class="clear"></view>
  30. </view>
  31. </view>
  32. <productType v-model="show"></productType>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. user: this.getUser(),
  40. show: false,
  41. sort: [{ name: '综合' }, { name: '日期' }, { name: '价格' }],
  42. list: [{}, {}, {}, {}],
  43. param: { pageNo: 1, pageSize: 10 },
  44. loadMore: true
  45. };
  46. },
  47. onLoad(e) {
  48. //this.getData();
  49. },
  50. methods: {
  51. getData() {
  52. this.http.request({
  53. url: '/level-one-server/app/TbGoodsTransit/getTransitList',
  54. data: this.param,
  55. loading: 'false',
  56. success: res => {
  57. this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
  58. this.list.push(...res.data.data);
  59. }
  60. });
  61. },
  62. detail(item) {
  63. uni.navigateTo({ url: '/pages/market/two/detail?id=' + item.id });
  64. },
  65. //刷新数据
  66. refresh() {
  67. this.loadMore = true;
  68. this.param.pageNum = 1;
  69. this.list = [];
  70. this.getData();
  71. }
  72. },
  73. //下拉刷新
  74. onPullDownRefresh() {
  75. setTimeout(() => {
  76. this.refresh();
  77. uni.stopPullDownRefresh();
  78. }, 1000);
  79. },
  80. //上拉加载
  81. onReachBottom() {
  82. if (this.loadMore) {
  83. this.param.pageNum++;
  84. this.getData();
  85. }
  86. }
  87. };
  88. </script>
  89. <style lang="scss">
  90. page {
  91. background-color: $pg;
  92. }
  93. .search {
  94. padding: 12px 12px 0px 12px;
  95. }
  96. </style>