list.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 :src="item.goodsImg" mode="aspectFill" class="pic"></image> -->
  23. <image @click="detail(item)" src="../../../static/news.jpg" mode="aspectFill" class="pic"></image>
  24. <view class="con">
  25. <view class="productName omit" @click="detail(item)">{{item.goodsName}}</view>
  26. <view class="desc" @click="detail(item)">{{item.goodsQuantity}}吨</view>
  27. <!-- <view class="price">¥ 5000</view> -->
  28. <view class="btn" v-if="user.userType == 2" @click="confirm(item)">立即接单</view>
  29. </view>
  30. <view class="clear"></view>
  31. </view>
  32. </view>
  33. <productType v-model="show"></productType>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. user: this.getUser(),
  41. show: false,
  42. sort: [{ name: '综合' }, { name: '日期' }, { name: '价格' }],
  43. list: [],
  44. param: { pageNo: 1, pageSize: 10 },
  45. loadMore: true
  46. };
  47. },
  48. onLoad(e) {
  49. this.getData();
  50. },
  51. methods: {
  52. getData() {
  53. this.http.request({
  54. url: '/level-two-server/app/TbGoodsDemand/getAppList',
  55. data: this.param,
  56. loading: 'false',
  57. success: res => {
  58. this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
  59. this.list.push(...res.data.data);
  60. }
  61. });
  62. },
  63. detail(item) {
  64. uni.navigateTo({ url: '/pages/market/two/detail?id=' + item.id });
  65. },
  66. confirm(item){
  67. uni.navigateTo({ url: '/pages/market/two/leader/confirm?id=' + item.id })
  68. },
  69. //刷新数据
  70. refresh() {
  71. this.loadMore = true;
  72. this.param.pageNum = 1;
  73. this.list = [];
  74. this.getData();
  75. }
  76. },
  77. //下拉刷新
  78. onPullDownRefresh() {
  79. setTimeout(() => {
  80. this.refresh();
  81. uni.stopPullDownRefresh();
  82. }, 1000);
  83. },
  84. //上拉加载
  85. onReachBottom() {
  86. if (this.loadMore) {
  87. this.param.pageNum++;
  88. this.getData();
  89. }
  90. }
  91. };
  92. </script>
  93. <style lang="scss">
  94. page {
  95. background-color: $pg;
  96. }
  97. .search {
  98. padding: 12px 12px 0px 12px;
  99. }
  100. .btn{
  101. width: 120rpx;
  102. height: 40rpx;
  103. background-color: #fff;
  104. color: #000;
  105. border: #B5B5B5 1px solid;
  106. position: relative;
  107. left: 350rpx;
  108. font-size: 14px;
  109. }
  110. </style>