list.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view>
  3. <view class="tab">
  4. <u-tabs :list="tab" @click="click" :lineHeight="5"></u-tabs>
  5. </view>
  6. <view class="goodsManageList">
  7. <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
  8. <view class="top">
  9. <view class="title omit">{{ item.goodsName }}</view>
  10. <view class="icon">&#xe852;</view>
  11. <view class="clear"></view>
  12. </view>
  13. <view class="con">
  14. <view class="flex fs">
  15. <view class="f left" style="flex: 0.5">
  16. <view class="tag">商品量:{{ item.goodsQuantity }}</view>
  17. </view>
  18. <view class="f left">
  19. <view class="tag">{{ item.createTime }}</view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="op">
  24. <view class="flex">
  25. <view class="f rline">
  26. <text class="icon" style="color: #ff660d">&#xe668;</text>
  27. <text>编辑</text>
  28. </view>
  29. <view class="f">
  30. <text class="icon" style="color: #0081ff">&#xe743;</text>
  31. <text>发布</text>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="clear"></view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. tab: [//isRelease:是否发布[0=待发布,1=已发布] isOrders:是否被接单[0=待接单,1=已被接单]
  45. { name: '全部', isRelease: '' ,isOrders: ''},
  46. { name: '待发布', isRelease: 0 ,isOrders: 0},
  47. { name: '发布中', isRelease: 1 ,isOrders: 0},
  48. { name: '已接单', isRelease: 1 ,isOrders: 1},
  49. //{ name: '已确认', isRelease: 1 ,isOrders: 1},
  50. //{ name: '已完成', isRelease: 1 ,isOrders: 1}
  51. ],
  52. list: [],
  53. param: { pageNo: 1, pageSize: 10 },
  54. loadMore: true
  55. };
  56. },
  57. onLoad(e) {
  58. this.getData();
  59. },
  60. methods: {
  61. getData() {
  62. this.http.request({
  63. url: '/level-two-server/app/TbGoodsDemand/getAppList',
  64. data: this.param,
  65. loading: 'false',
  66. success: res => {
  67. this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
  68. this.list.push(...res.data.data);
  69. }
  70. });
  71. },
  72. //点击tab切换
  73. click(e) {
  74. this.param.isRelease = e.isRelease;
  75. this.param.isOrders = e.isOrders;
  76. this.refresh();
  77. },
  78. detail(item) {
  79. uni.navigateTo({ url: '/pages/market/two/purchaser/buy/detail?id=' + item.id });
  80. },
  81. //刷新数据
  82. refresh() {
  83. this.loadMore = true;
  84. this.param.pageNo = 1;
  85. this.list = [];
  86. this.getData();
  87. }
  88. },
  89. //下拉刷新
  90. onPullDownRefresh() {
  91. setTimeout(() => {
  92. this.refresh();
  93. uni.stopPullDownRefresh();
  94. }, 1000);
  95. },
  96. //上拉加载
  97. onReachBottom() {
  98. if (this.loadMore) {
  99. this.param.pageNo++;
  100. this.getData();
  101. }
  102. },
  103. onNavigationBarButtonTap() {
  104. uni.navigateTo({ url: '/pages/market/two/purchaser/buy/add' });
  105. }
  106. };
  107. </script>
  108. <style lang="scss">
  109. page {
  110. background-color: $pg;
  111. }
  112. </style>