list.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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">
  21. <view class="title" @click="detail(item)">{{ item.createName }}</view>
  22. <image @click="detail(item)" src="../../../static/news.jpg" mode="aspectFill" class="pic"></image>
  23. <view class="con">
  24. <view class="productName omit" @click="detail(item)">{{ item.goodsName }}</view>
  25. <view class="desc" @click="detail(item)">{{ item.goodsQuantity }}吨</view>
  26. <view class="btn" v-if="user.userType == 2" @click="confirm(item)">立即接单</view>
  27. </view>
  28. </view>
  29. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  30. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  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-two-server/app/TbGoodsDemand/getList',
  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. confirm(item) {
  66. uni.navigateTo({ url: '/pages/market/two/leader/confirm?id=' + item.id });
  67. },
  68. //刷新数据
  69. refresh() {
  70. this.loadMore = true;
  71. this.param.pageNum = 1;
  72. this.list = [];
  73. this.getData();
  74. }
  75. },
  76. //下拉刷新
  77. onPullDownRefresh() {
  78. setTimeout(() => {
  79. this.refresh();
  80. uni.stopPullDownRefresh();
  81. }, 1000);
  82. },
  83. //上拉加载
  84. onReachBottom() {
  85. if (this.loadMore) {
  86. this.param.pageNum++;
  87. this.getData();
  88. }
  89. }
  90. };
  91. </script>
  92. <style lang="scss">
  93. page {
  94. background-color: $pg;
  95. }
  96. .btn {
  97. width: 120rpx;
  98. height: 40rpx;
  99. background-color: #fff;
  100. color: #000;
  101. border: #b5b5b5 1px solid;
  102. position: relative;
  103. left: 350rpx;
  104. font-size: 14px;
  105. }
  106. </style>