cooperative.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <view class="container">
  3. <!-- 供销社列表 -->
  4. <view class="rnwdList" v-for="(item, index) in list" :key="index">
  5. <view @tap="goDetails(item.id)" class="cooperativeImgBox" style="width: 30%;">
  6. <!--<image :src="loadImgSrc('/snbj.png')" class="cooperativeImg"></image>-->
  7. <image :src="loadImgSrcLocalhost(item.imgUrl)" class="cooperativeImg"></image>
  8. </view>
  9. <view @tap="goDetails(item.id)" class="cooperativeBox">
  10. <view class="list">
  11. <span class="listTitle">{{ item.name }}</span>
  12. <view class="jlSj">
  13. <span class="jf">
  14. {{ item.address?item.address:'' }}
  15. </span>
  16. </view>
  17. </view>
  18. </view>
  19. <em class="iconfont icon-xiangyoujiantou"></em>
  20. </view>
  21. <uni-load-more :status="status" :content-text="contentText"/>
  22. <uni-fab ref="fab" horizontal="right" vertical="bottom"
  23. @fabClick="handleAdd()"/>
  24. </view>
  25. </template>
  26. <script>
  27. import { getList, getDetails } from '@/api/highFrequencyService/cooperative/cooperative';
  28. export default {
  29. data() {
  30. return {
  31. // 查询参数
  32. queryParams: {
  33. pageNum: 1,
  34. pageSize: 15,
  35. id: null,
  36. status:"1",
  37. },
  38. // 加载更多
  39. status: 'more',
  40. contentText: {
  41. contentdown: '查看更多',
  42. contentrefresh: '加载中',
  43. contentnomore: '------------------我是有底线的------------------'
  44. },
  45. // 列表数据
  46. list: [
  47. {
  48. name:"-",
  49. address:"-",
  50. chargePeople:"-",
  51. chargePhone:"-",
  52. imgUrl:"-"
  53. }
  54. ],
  55. total:0
  56. };
  57. },
  58. onPullDownRefresh() {
  59. this.queryParams.pageNum = 1;
  60. this.list = [];
  61. this.getList()
  62. },
  63. //上拉加载
  64. onReachBottom(){
  65. let pageNum = this.queryParams.pageNum;
  66. let pageSize = this.queryParams.pageSize;
  67. let total = this.total;
  68. if(pageNum * pageSize >= total){
  69. uni.showToast({
  70. title:'暂无更多数据'
  71. });
  72. return;
  73. } else {
  74. this.queryParams.pageNum += 1;
  75. this.getList()
  76. }
  77. }
  78. /**
  79. * 生命周期函数--监听页面加载
  80. */,
  81. onLoad(options) {
  82. this.getList();
  83. },
  84. methods: {
  85. /** 新增按钮操作 */
  86. handleAdd(){
  87. uni.navigateTo({
  88. url: '/pages/highServer/cooperative/addCooperative'
  89. });
  90. },
  91. /** 查询列表 */
  92. getList(type) {
  93. this.loading = true;
  94. getList(this.queryParams).then(response => {
  95. this.total = response.total
  96. if (this.queryParams.pageNum === 1) {
  97. this.list = response.rows;
  98. } else {
  99. this.list = this.list.concat(response.rows);
  100. }
  101. // 判断是否还有更多数据
  102. if (response.rows.length < this.queryParams.pageSize) {
  103. this.status = 'noMore'; // 没有更多数据
  104. } else {
  105. this.status = 'more'; // 还有更多数据
  106. }
  107. });
  108. },
  109. /** 查询详情 */
  110. goDetails(id) {
  111. uni.navigateTo({
  112. url: '/pages/highServer/cooperative/details?id='+id
  113. });
  114. }
  115. }
  116. };
  117. </script>
  118. <style>
  119. @import './cooperative.css';
  120. </style>