cooperative.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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">
  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. };
  56. },
  57. onPullDownRefresh() {
  58. this.queryParams.pageNum = 1;
  59. this.list = [];
  60. this.getList()
  61. },
  62. //上拉加载
  63. onReachBottom(){
  64. let pageNum = this.queryParams.pageNum;
  65. let pageSize = this.queryParams.pageSize;
  66. let total = this.total;
  67. if(pageNum*pageSize >= total){
  68. uni.showToast({
  69. title:'暂无更多数据'
  70. });
  71. return;
  72. } else {
  73. this.queryParams.pageNum += 1;
  74. this.getList()
  75. }
  76. }
  77. /**
  78. * 生命周期函数--监听页面加载
  79. */,
  80. onLoad(options) {
  81. this.getList();
  82. },
  83. methods: {
  84. /** 新增按钮操作 */
  85. handleAdd(){
  86. uni.navigateTo({
  87. url: '/pages/highServer/cooperative/addCooperative'
  88. });
  89. },
  90. /** 查询列表 */
  91. getList(type) {
  92. this.loading = true;
  93. getList().then(response => {
  94. if (this.queryParams.pageNum === 1) {
  95. this.list = response.rows;
  96. } else {
  97. this.list = this.list.concat(response.rows);
  98. }
  99. // 判断是否还有更多数据
  100. if (response.rows.length < this.queryParams.pageSize) {
  101. this.status = 'noMore'; // 没有更多数据
  102. } else {
  103. this.status = 'more'; // 还有更多数据
  104. }
  105. });
  106. },
  107. /** 查询详情 */
  108. goDetails(id) {
  109. uni.navigateTo({
  110. url: '/pages/highServer/cooperative/details?id='+id
  111. });
  112. }
  113. }
  114. };
  115. </script>
  116. <style>
  117. @import './cooperative.css';
  118. </style>