index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <script setup>
  2. import {
  3. ref
  4. } from "vue";
  5. import {
  6. onLoad,
  7. onPullDownRefresh,
  8. onReachBottom,
  9. onPageScroll,
  10. } from "@dcloudio/uni-app";
  11. import {
  12. getIntermediaryList,
  13. } from "@/api/work/intermediaryService.js";
  14. // 页面标题
  15. let pageName = ref(null);
  16. // 滚动
  17. let scrollTop = ref(0);
  18. // 搜索条件
  19. let searchInfo = ref({
  20. pageNo: 1,
  21. pageSize: 10,
  22. type: null
  23. });
  24. // 列表
  25. let policyList = ref([]);
  26. let listTotal = ref(0);
  27. // 获取列表
  28. let loading = ref(true);
  29. const getList = function() {
  30. if (searchInfo.value.pageNo == 1) {
  31. loading.value = true
  32. };
  33. getIntermediaryList(searchInfo.value).then(res => {
  34. loading.value = false;
  35. policyList.value = policyList.value.concat(res.data.list);
  36. listTotal.value = res.data.total;
  37. if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list.length))
  38. moreListFlag = false;
  39. }).catch(() => {
  40. loading.value = false;
  41. })
  42. };
  43. // 折叠/展开
  44. const changeFoldItem = (status, id) => {
  45. let item = policyList.value.find(item => item.id === id);
  46. item.unfold = status;
  47. }
  48. // 去详情
  49. const gotoDetail = id => {
  50. uni.navigateTo({
  51. url: `/pages/intermediaryService/detail/index?id=${id}`
  52. })
  53. }
  54. // 触底加载flag
  55. let moreListFlag = true
  56. onLoad(options => {
  57. pageName = options.title;
  58. searchInfo.value.type = options.id;
  59. getList();
  60. });
  61. onPullDownRefresh(() => {
  62. searchInfo.value.pageNo = 1;
  63. policyList.value = [];
  64. moreListFlag = true;
  65. try {
  66. getList();
  67. } finally {
  68. uni.stopPullDownRefresh();
  69. }
  70. });
  71. onReachBottom(() => {
  72. if (!moreListFlag) {
  73. return uni.showToast({
  74. title: "已经到底了。",
  75. icon: "none",
  76. duration: 2000
  77. })
  78. }
  79. searchInfo.value.pageNo++;
  80. getList();
  81. });
  82. onPageScroll((e) => {
  83. scrollTop.value = e.scrollTop
  84. })
  85. </script>
  86. <template>
  87. <view class="container">
  88. <page-title>{{pageName}}</page-title>
  89. <view class="items-list">
  90. <view v-for="(item,index) in policyList" :key="index">
  91. <!-- 未折叠卡片 -->
  92. <view class="card" v-if="item.unfold">
  93. <view class="card-item">
  94. <view class="card-item-name">企业名称</view>
  95. <view class="card-item-content">{{item.title ?? "--"}}</view>
  96. </view>
  97. <view class="card-item">
  98. <view class="card-item-name">统一社会信用代码</view>
  99. <view class="card-item-content">{{item.groupCode ?? "--"}}</view>
  100. </view>
  101. <view class="card-item">
  102. <view class="card-item-name">业务负责人</view>
  103. <view class="card-item-content">{{item.businessOwner || "--"}}</view>
  104. </view>
  105. <view class="card-item">
  106. <view class="card-item-name">业务负责人联系电话</view>
  107. <view class="card-item-content">{{item.businessPhone || "--"}}</view>
  108. </view>
  109. <view class="card-item">
  110. <view class="card-item-name">备注</view>
  111. <view class="card-item-content">{{item.remark || "--"}}</view>
  112. </view>
  113. <view class="card-item bottom-item">
  114. <view class="card-btn fat-btn" @click="gotoDetail(item.id)">详情</view>
  115. </view>
  116. <view class="card-fold-option">
  117. <view class="card-fold-count">{{index + 1}} / {{listTotal}}</view>
  118. <view class="card-fold-center" @click.stop="changeFoldItem(false,item.id)">
  119. <view class="card-fold-btn card-unfold-btn"></view>
  120. </view>
  121. <view class="card-fold-chaos"></view>
  122. </view>
  123. </view>
  124. <!-- 折叠卡片 -->
  125. <view class="card-fold" v-else>
  126. {{item.title ?? "--"}}
  127. <view class="card-fold-option">
  128. <view class="card-fold-count">{{index + 1}} / {{listTotal}}</view>
  129. <view class="card-fold-center" @click.stop="changeFoldItem(true, item.id)">
  130. <view class="card-fold-btn"></view>
  131. </view>
  132. <view class="card-fold-chaos"></view>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. <u-back-top :scroll-top="scrollTop"></u-back-top>
  138. <u-loading-page :loading="loading"></u-loading-page>
  139. </view>
  140. </template>
  141. <style lang="scss" scoped>
  142. .items-list {
  143. position: absolute;
  144. top: 5%;
  145. left: 0;
  146. width: 100%;
  147. min-height: 95%;
  148. padding: 100rpx 4%;
  149. background: #F9FBFF;
  150. // border-radius: 40rpx 40rpx 0 0;
  151. }
  152. .item {
  153. margin-top: 20rpx;
  154. display: flex;
  155. align-items: center;
  156. width: 100%;
  157. min-height: 140rpx;
  158. padding: 26rpx 28rpx;
  159. box-sizing: border-box;
  160. background: #FFFFFF;
  161. box-shadow: 0rpx 18rpx 48rpx -4rpx rgba(150, 176, 220, 0.2);
  162. border-radius: 24rpx;
  163. .item-icon {
  164. width: 82rpx;
  165. height: 82rpx;
  166. margin-right: 32rpx;
  167. // background-image: url("@/static/policy-icon.png");
  168. // background-size: 100% 100%;
  169. }
  170. .item-text {
  171. width: 70%;
  172. height: 100%;
  173. word-break: break-all;
  174. .item-title {
  175. width: 100%;
  176. color: #343437;
  177. font-size: 28rpx;
  178. margin-bottom: 30rpx;
  179. }
  180. .item-kind {
  181. width: fit-content;
  182. min-height: 38rpx;
  183. padding: 10rpx;
  184. box-sizing: border-box;
  185. text-align: center;
  186. color: #1763E7;
  187. font-size: 24rpx;
  188. line-height: 38rpx;
  189. background: #DEEAFF;
  190. border-radius: 12rpx;
  191. }
  192. .item-rptDate {
  193. width: 100%;
  194. color: #343437;
  195. font-size: 28rpx;
  196. margin-bottom: 30rpx;
  197. }
  198. }
  199. .item-btn {
  200. width: 106rpx;
  201. height: 58rpx;
  202. background: #1763E7;
  203. border-radius: 16rpx;
  204. color: #FFF;
  205. font-size: 28rpx;
  206. text-align: center;
  207. line-height: 58rpx;
  208. margin-left: 20rpx;
  209. }
  210. }
  211. .card-fold {
  212. position: relative;
  213. width: 100%;
  214. min-height: 152rpx;
  215. margin-bottom: 20rpx;
  216. padding: 24rpx 30rpx 52rpx;
  217. box-sizing: border-box;
  218. background: #FFFFFF;
  219. border-radius: 40rpx;
  220. overflow: hidden;
  221. }
  222. .card-fold-option {
  223. position: absolute;
  224. display: flex;
  225. justify-content: space-between;
  226. align-items: center;
  227. left: 0;
  228. bottom: 0;
  229. width: 100%;
  230. height: 38rpx;
  231. padding: 0 40rpx;
  232. box-sizing: border-box;
  233. background: linear-gradient(270deg, #CADDFF 4%, rgba(219, 232, 255, 0) 100%);
  234. z-index: 999;
  235. .card-fold-count {
  236. flex: 1;
  237. font-size: 28rpx;
  238. color: #1869F6;
  239. }
  240. .card-fold-center {
  241. flex: 1;
  242. .card-fold-btn {
  243. width: 32rpx;
  244. height: 20rpx;
  245. margin: 0 auto;
  246. background-image: url("@/static/icon-fold.png");
  247. background-size: 100% 100%;
  248. }
  249. .card-unfold-btn {
  250. transform: rotate(180deg);
  251. }
  252. }
  253. .card-fold-chaos {
  254. flex: 1;
  255. }
  256. }
  257. .bottom-item {
  258. margin-bottom: 20rpx;
  259. }
  260. </style>