index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <view class="container">
  3. <page-title @searchClick='searchClick' :showSearch='true'>企业信息({{listTotal}})</page-title>
  4. <!-- <view class="back-btn">
  5. <u-icon name="arrow-left" color="#fff" size="20" customStyle="margin:0 auto" @click="backToBefore()"></u-icon>
  6. <text class="back-text" @click="backToBefore()">企业信息</text>
  7. <u-icon name="search" color="#fff" size="30" customStyle="position:absolute;top:0;right:0"
  8. @click="goToPage('/pages/enterpriseInfo/search/index')"></u-icon>
  9. </view> -->
  10. <view class="cards-list">
  11. <view class="card-layer" v-for="(item,index) in enterpriseList" :key="index">
  12. <view class="card-num">
  13. {{index+1}}
  14. </view>
  15. <view class="card-title">
  16. <text> {{item.title ?? "--"}}</text>
  17. <view class="title-right">
  18. <view class="view-btn" @click="gotoDetail(item.id,item.title)">
  19. 查看
  20. </view>
  21. <u-icon v-if='item.isOpen' name="arrow-up" color="#002F69" size="16" @click="onChangeCard(index)"></u-icon>
  22. <u-icon v-else name="arrow-down" color="#002F69" size="16" @click="onChangeCard(index)"></u-icon>
  23. </view>
  24. </view>
  25. <view class="card-item-list"
  26. :style="item.isOpen ? {height:'150rpx'} : {borderColor:'transparent',marginTop:'0'}">
  27. <view class="item">
  28. <view class="item-label">所在地区</view>
  29. <view class="item-text">
  30. {{item.area || "--"}}
  31. </view>
  32. </view>
  33. <view class="item">
  34. <view class="item-label">当前状态</view>
  35. <view class="item-text">
  36. {{item.status || "--"}}
  37. </view>
  38. </view>
  39. <view class="item">
  40. <view class="item-label">注册资金</view>
  41. <view class="item-text">
  42. {{(item.amt!= null)? item.amt : "--"}}
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <empty-show v-if="enterpriseList.length===0"></empty-show>
  48. </view>
  49. <u-back-top :scroll-top="scrollTop"></u-back-top>
  50. <u-loading-page :loading="loading"></u-loading-page>
  51. </view>
  52. </template>
  53. <script setup>
  54. import {
  55. ref
  56. } from 'vue'
  57. import {
  58. onLoad,
  59. onUnload,
  60. onPullDownRefresh,
  61. onReachBottom,
  62. onPageScroll
  63. } from "@dcloudio/uni-app"
  64. import {
  65. getEnterpriseInfoList,
  66. } from "@/api/work/enterpriseInfo.js"
  67. // 返回上一级
  68. function backToBefore() {
  69. uni.reLaunch({
  70. url: "/pages/index"
  71. });
  72. };
  73. function goToPage(url) {
  74. uni.navigateTo({
  75. url
  76. })
  77. }
  78. let scrollTop = ref(0);
  79. let loading = ref(true);
  80. // 参数
  81. let searchInfo = ref({
  82. pageNo: 1,
  83. pageSize: 10,
  84. })
  85. function searchClick() {
  86. goToPage('/pages/enterpriseInfo/search/index')
  87. }
  88. // 获取列表
  89. function getList() {
  90. let params = {
  91. pageNo: searchInfo.value.pageNo,
  92. pageSize: searchInfo.value.pageSize,
  93. title: searchInfo.value.title,
  94. status: searchInfo.value.status
  95. }
  96. if (searchInfo.value.pageNo == 1) {
  97. loading.value = true
  98. }
  99. getEnterpriseInfoList(params).then(res => {
  100. loading.value = false
  101. enterpriseList.value = enterpriseList.value.concat(res.data.list)
  102. listTotal.value = res.data.total
  103. if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list.length))
  104. moreListFlag = false;
  105. }).catch(() => {
  106. loading.value = false
  107. })
  108. }
  109. let cardCurrut = ref(0)
  110. function onChangeCard(e) {
  111. if (cardCurrut.value == e) {
  112. enterpriseList.value[cardCurrut.value].isOpen = !enterpriseList.value[cardCurrut.value].isOpen
  113. } else {
  114. enterpriseList.value[cardCurrut.value].isOpen = false
  115. enterpriseList.value[e].isOpen = true
  116. cardCurrut.value = e
  117. }
  118. }
  119. // 主要列表
  120. let enterpriseList = ref([]);
  121. let listTotal = ref(0);
  122. // 去详情
  123. function gotoDetail(id, subName) {
  124. uni.navigateTo({
  125. url: `/pages/enterpriseInfo/detail/index?id=${id}&subName=${subName}`
  126. })
  127. }
  128. // 触底加载flag
  129. let moreListFlag = true
  130. onLoad(options => {
  131. // searchInfo.value = Object.assign(searchInfo.value, options)
  132. // let filterArr = ["null", "undefined", ""]
  133. // for (let i in searchInfo.value) {
  134. // if (filterArr.includes(searchInfo.value[i])) {
  135. // searchInfo.value[i] = null
  136. // }
  137. // }
  138. uni.$on('enterpriseInfoSearch', resolve => {
  139. searchInfo.value = Object.assign(searchInfo.value, resolve);
  140. searchInfo.value.pageNo = 1;
  141. enterpriseList.value = [];
  142. listTotal.value = 0;
  143. moreListFlag = true;
  144. getList();
  145. })
  146. getList();
  147. })
  148. onUnload(() => {
  149. uni.$off('enterpriseInfoSearch');
  150. });
  151. onPageScroll((e) => {
  152. scrollTop.value = e.scrollTop
  153. })
  154. onPullDownRefresh(() => {
  155. searchInfo.value.pageNo = 1;
  156. enterpriseList.value = [];
  157. moreListFlag = true;
  158. try {
  159. getList();
  160. } finally {
  161. uni.stopPullDownRefresh()
  162. }
  163. })
  164. onReachBottom(() => {
  165. if (!moreListFlag) {
  166. return uni.showToast({
  167. title: "已经到底了。",
  168. icon: "none",
  169. duration: 2000
  170. })
  171. }
  172. searchInfo.value.pageNo++;
  173. getList();
  174. })
  175. </script>
  176. <style lang="scss" scoped>
  177. .card-layer {
  178. position: relative;
  179. margin-top: 32rpx;
  180. padding: 16rpx 24rpx;
  181. width: 100%;
  182. box-shadow: 0rpx 0rpx 8rpx 0rpx #D8EEFF;
  183. border-radius: 12rpx;
  184. background: #FFFFFF;
  185. .card-num {
  186. position: absolute;
  187. // left: 30rpx;
  188. // top: 32rpx;
  189. display: flex;
  190. justify-content: center;
  191. align-items: center;
  192. width: 64rpx;
  193. height: 64rpx;
  194. border-radius: 4rpx;
  195. border: 1rpx solid #F4F4F4;
  196. font-size: 24rpx;
  197. color: #B5B5B5;
  198. }
  199. .card-title {
  200. margin-left: 95rpx;
  201. width: calc(100% - 90rpx);
  202. min-height: 80rpx;
  203. display: flex;
  204. align-items: center;
  205. justify-content: space-between;
  206. gap: 20rpx;
  207. text {
  208. flex-grow: 1;
  209. }
  210. .title-right {
  211. display: flex;
  212. justify-content: flex-end;
  213. align-items: center;
  214. gap: 20rpx;
  215. .view-btn {
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. width: 100rpx;
  220. height: 48rpx;
  221. background: #D6ECFF;
  222. border-radius: 30rpx;
  223. font-size: 28rpx;
  224. font-weight: 500;
  225. color: #002F69;
  226. }
  227. }
  228. }
  229. .card-input-btn {
  230. position: absolute;
  231. top: 24rpx;
  232. right: 0;
  233. display: flex;
  234. justify-content: center;
  235. align-items: center;
  236. gap: 10rpx;
  237. background: #5FA6F5;
  238. padding: 22rpx 15rpx 22rpx 20rpx;
  239. border-radius: 24rpx 0rpx 0rpx 24rpx;
  240. font-weight: 500;
  241. font-size: 32rpx;
  242. color: #FFFFFF;
  243. }
  244. .card-view {
  245. display: flex;
  246. justify-content: flex-end;
  247. align-items: center;
  248. gap: 20rpx;
  249. .item-btn {
  250. display: flex;
  251. justify-content: center;
  252. align-items: center;
  253. width: 96rpx;
  254. height: 48rpx;
  255. border-radius: 8rpx;
  256. border: 1rpx solid #D4E7FF;
  257. font-weight: 500;
  258. font-size: 28rpx;
  259. color: #6C90C1;
  260. }
  261. }
  262. .card-item-list {
  263. width: 100%;
  264. height: 0;
  265. overflow: hidden;
  266. transition: all .3s;
  267. margin-top: 30rpx;
  268. border-top: 1rpx dashed #DDDDDD;
  269. .item {
  270. margin-top: 15rpx;
  271. display: flex;
  272. justify-content: flex-start;
  273. align-items: center;
  274. gap: 20rpx;
  275. width: 450rpx;
  276. height: 30rpx;
  277. .item-label {
  278. font-weight: 500;
  279. font-size: 24rpx;
  280. color: #B5B5B5;
  281. }
  282. .item-text {
  283. font-weight: 500;
  284. font-size: 24rpx;
  285. color: #666666;
  286. }
  287. }
  288. }
  289. }
  290. </style>