resultSquare.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template>
  2. <view class="container">
  3. <u-sticky>
  4. <view class="searchBox">
  5. <u-search bgColor="rgba(217,217,217,0.3)" placeholder="请输入关键字" :showAction="false"
  6. v-model="param.keywords" @search="search"></u-search>
  7. <view class="menu" @click="listModeChange()">
  8. <image v-if="listMode=='list'" src="/static/img/list.png" mode=""></image>
  9. <image v-if="listMode=='img'" style="width:40rpx;height:34rpx" src="/static/img/img.png" mode="">
  10. </image>
  11. {{listMode=='img'?'图片展示':'列表展示'}}
  12. </view>
  13. </view>
  14. </u-sticky>
  15. <view class="selBox">
  16. <view class="selBox_l">
  17. <view @click="sortShow=true">
  18. <view>{{sortValue2 ? sortValue2 : '建成年份先后'}}</view>
  19. <u-icon name="arrow-down"></u-icon>
  20. </view>
  21. <image v-if="param.sortType==1" @click="sortTypeChange(2)" src="/static/img/switch.png" mode=""></image>
  22. <image v-if="param.sortType==2" @click="sortTypeChange(1)" src="/static/img/switch_a.png" mode="">
  23. </image>
  24. </view>
  25. <view class="selBox_r" @click="typeShow=true">
  26. 筛选
  27. <image src="/static/img/menu1.png" mode=""></image>
  28. </view>
  29. </view>
  30. <view class="imgList" v-if="listMode=='img'">
  31. <view v-for="(v,i) in list" :key="i">
  32. <view class="imgList_item" @click="goDetail(v)">
  33. <u--image :src="v.projectListPicture" width="340rpx" height="auto" mode="widthFix">
  34. <template v-slot:loading>
  35. <image class="loading" src="../../static/loading.png" mode=""></image>
  36. </template>
  37. </u--image>
  38. <view class="imgList_item_txt">{{v.projectName}}/{{v.projectTeam}}</view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="list" v-if="listMode=='list'">
  43. <view class="list_item" v-for="(v,i) in list" @click="goDetail(v)">
  44. <view class="list_item_l">
  45. <view class="list_item_l_title">{{v.projectName}}</view>
  46. <view>
  47. <view>建成年份:{{v.stageFinishDate||"—"}} </view>
  48. <view class="ml10">设计年份:{{v.stageDesignDate||"—"}} </view>
  49. </view>
  50. <view>
  51. <view>占地面积:{{v.stageLandArea||"—"}}㎡ </view>
  52. <view class="ml10">建筑面积:{{v.stageBuildArea||"—"}} </view>
  53. </view>
  54. </view>
  55. <view class="list_item_r">
  56. <image src="/static/img/right.png" mode=""></image>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="loadmoreBox">
  61. <u-loadmore v-if="list.length>0" :status="status" />
  62. <u-empty v-if="list.length<=0&&status==='nomore'" textSize="16" mode="list" marginTop="100">
  63. </u-empty>
  64. </view>
  65. <u-popup :show="typeShow" mode="bottom" round="50rpx" @close="typeClose">
  66. <view class="popupBox">
  67. <view class="popupBox_title">筛选</view>
  68. <view class="popupBox_del" @click="typeClose"><u-icon name="close" color="#999999" size="20px"></u-icon>
  69. </view>
  70. <view class="popupBox_list">
  71. <view v-for="(v,i) in typeList" v-if="v.projectCategoryStatus" :key="i"
  72. :class="{active:param.projectTypeId==v.projectCategoryId}" @click="projectTypeIdChange(v)">
  73. {{v.projectCategoryName}}</view>
  74. </view>
  75. <view class="popupBox_btn">
  76. <view class="popupBox_btn_cel" @click="typeClose">取消</view>
  77. <view class="popupBox_btn_sub" @click="search()">确认</view>
  78. </view>
  79. </view>
  80. </u-popup>
  81. <u-popup :show="sortShow" mode="bottom" round="50rpx" @close="sortClose">
  82. <view class="popupBox">
  83. <view class="popupBox_title">年份类型</view>
  84. <view class="popupBox_del" @click="sortClose"><u-icon name="close" color="#999999" size="20px"></u-icon>
  85. </view>
  86. <view class="popupBox_list">
  87. <view class="sortPad" v-for="(v,i) in sortFieArr" :key="i"
  88. :class="{active:param.sortField==v.value}" @click="sortFieChange(v)">{{v.label}}</view>
  89. </view>
  90. <view class="popupBox_btn">
  91. <view class="popupBox_btn_cel" @click="sortClose">取消</view>
  92. <view class="popupBox_btn_sub" @click="search()">确认</view>
  93. </view>
  94. </view>
  95. </u-popup>
  96. </view>
  97. </template>
  98. <script>
  99. import {
  100. login,
  101. resultPlazaPage,
  102. projectCategoryList
  103. } from "@/api/index.js"
  104. export default {
  105. data() {
  106. return {
  107. listMode: "img",
  108. typeShow: false,
  109. // 加载前值为loadmore,加载中为loading,没有数据为nomore
  110. status: 'loadmore',
  111. param: {
  112. pageNum: 1,
  113. pageSize: 10,
  114. sortType: 1,
  115. projectTypeId: null,
  116. sortField: null
  117. },
  118. list: [],
  119. typeList: [],
  120. sortFieArr: [{
  121. label: "建成年份",
  122. value: 1
  123. },
  124. {
  125. label: "设计年份",
  126. value: 2
  127. },
  128. {
  129. label: "用地面积",
  130. value: 3
  131. },
  132. {
  133. label: "建筑面积",
  134. value: 4
  135. }
  136. ],
  137. sortShow: false,
  138. sortValue: '',
  139. sortValue2: '',
  140. }
  141. },
  142. onLoad() {},
  143. onPullDownRefresh() {
  144. this.param.pageNum = 1
  145. this.getList()
  146. },
  147. onReachBottom() {
  148. if (this.status == "loadmore") {
  149. this.param.pageNum++;
  150. this.getList()
  151. }
  152. },
  153. onLoad() {
  154. this.getList();
  155. this.getTypeList()
  156. },
  157. methods: {
  158. // 切换显示状态
  159. listModeChange() {
  160. this.listMode = this.listMode == 'list' ? 'img' : 'list'
  161. },
  162. // 搜索
  163. search() {
  164. this.sortValue2 = this.sortValue;
  165. this.param.pageNum = 1
  166. this.sortShow = false;
  167. this.typeShow = false;
  168. this.getList()
  169. },
  170. typeClose() {
  171. this.typeShow = false;
  172. this.param.projectTypeId = null;
  173. // this.search()
  174. },
  175. sortClose() {
  176. this.sortShow = false;
  177. this.param.sortField = null;
  178. // this.search()
  179. },
  180. sortTypeChange(sortType) {
  181. this.param.sortType = sortType;
  182. this.search()
  183. },
  184. projectTypeIdChange(row) {
  185. this.param.projectTypeId = this.param.projectTypeId !== row.projectCategoryId ? row.projectCategoryId :
  186. null;
  187. },
  188. sortFieChange(row) {
  189. this.sortValue = row.label;
  190. this.param.sortField = this.param.sortField !== row.value ? row.value : null;
  191. },
  192. //获取筛选的类型
  193. getTypeList() {
  194. projectCategoryList().then(res => {
  195. this.typeList = res.data
  196. })
  197. },
  198. goDetail(row) {
  199. uni.$u.route("pages/resultSquare/detail", {
  200. stageId: row.stageId
  201. })
  202. },
  203. getList() {
  204. uni.showLoading({
  205. title: '加载中'
  206. });
  207. this.status = "loading";
  208. resultPlazaPage(this.param).then(res => {
  209. if (this.param.pageNum == 1) {
  210. this.list = res.rows
  211. } else {
  212. this.list.push(...res.rows)
  213. }
  214. this.status = this.list.length < res.total ? "loadmore" : "nomore";
  215. }).finally(e => {
  216. uni.hideLoading();
  217. uni.stopPullDownRefresh();
  218. })
  219. }
  220. }
  221. }
  222. </script>
  223. <style lang="scss">
  224. .searchBox {
  225. padding: 25rpx 30rpx;
  226. display: flex;
  227. border-bottom: 8rpx solid #EBECF0;
  228. background: #fff;
  229. .menu {
  230. display: flex;
  231. align-items: center;
  232. font-size: 28rpx;
  233. color: #1A1A1A;
  234. margin-left: 30rpx;
  235. image {
  236. width: 31rpx;
  237. height: 27rpx;
  238. margin-right: 10rpx;
  239. margin-top: 5rpx;
  240. }
  241. }
  242. ::v-deep .u-search__content__input {
  243. background-color: transparent !important;
  244. }
  245. }
  246. .selBox {
  247. display: flex;
  248. justify-content: space-between;
  249. padding: 28rpx;
  250. .selBox_l {
  251. display: flex;
  252. align-items: center;
  253. >view {
  254. width: 252rpx;
  255. height: 70rpx;
  256. display: flex;
  257. align-items: center;
  258. justify-content: space-between;
  259. padding: 0 15rpx;
  260. box-sizing: border-box;
  261. font-size: 26rpx;
  262. color: #D9D9D9;
  263. background: #ffffff;
  264. border: 1rpx solid #cccccc;
  265. border-radius: 8rpx;
  266. }
  267. image {
  268. width: 32rpx;
  269. height: 36rpx;
  270. margin-left: 4rpx;
  271. }
  272. }
  273. .selBox_r {
  274. display: flex;
  275. align-items: center;
  276. font-size: 28rpx;
  277. image {
  278. width: 30rpx;
  279. height: 30rpx;
  280. margin-left: 4rpx;
  281. }
  282. }
  283. }
  284. .imgList {
  285. padding: 0 28rpx;
  286. // display: flex;
  287. column-count: 2;
  288. /* 定义列数为3:将图片分为3列 */
  289. column-gap: 20rpx;
  290. // column-width:320rpx;
  291. -webkit-column-fill: auto;
  292. >view {
  293. -webkit-column-break-inside: avoid;
  294. /* Chrome, Safari, Opera */
  295. page-break-inside: avoid;
  296. /* Firefox */
  297. break-inside: avoid;
  298. // -webkit-overflow-scrolling : touch;
  299. }
  300. /* IE 10+, Chrome, Safari, Opera */
  301. .imgList_item {
  302. font-size: 0;
  303. width: 340rpx;
  304. border-radius: 20rpx;
  305. overflow: hidden;
  306. padding-bottom: 30rpx;
  307. /deep/ .u-image {
  308. min-height: 160rpx;
  309. }
  310. >.imgList_item_txt {
  311. font-size: 26rpx;
  312. color: #1A1A1A;
  313. background: #F2F2F2;
  314. padding: 16rpx 20rpx;
  315. line-height: 36rpx;
  316. font-weight: 700;
  317. border-radius:0 0 20rpx 20rpx;
  318. }
  319. }
  320. }
  321. .list {
  322. padding: 0rpx 28rpx 0;
  323. .list_item {
  324. display: flex;
  325. justify-content: space-between;
  326. align-items: center;
  327. padding-bottom: 16rpx;
  328. border-bottom: 1rpx solid #E6E6E6;
  329. margin-bottom: 30rpx;
  330. .list_item_l {
  331. font-size: 24rpx;
  332. color: #808080;
  333. .list_item_l_title {
  334. font-size: 28rpx;
  335. color: #1A1A1A;
  336. font-weight: 500;
  337. }
  338. >view {
  339. display: flex;
  340. margin-bottom: 20rpx;
  341. }
  342. }
  343. .list_item_r {
  344. image {
  345. width: 19rpx;
  346. height: 36rpx;
  347. }
  348. }
  349. }
  350. }
  351. .popupBox {
  352. padding: 0 20rpx;
  353. position: relative;
  354. .popupBox_title {
  355. font-size: 36rpx;
  356. color: #1A1A1A;
  357. font-weight: 700;
  358. text-align: center;
  359. margin-top: 45rpx;
  360. margin-bottom: 65rpx;
  361. }
  362. .popupBox_del {
  363. position: absolute;
  364. right: 30rpx;
  365. top: 40rpx;
  366. }
  367. .popupBox_list {
  368. display: flex;
  369. flex-wrap: wrap;
  370. >view {
  371. background: #F5F5F5;
  372. font-size: 24rpx;
  373. color: #1A1A1A;
  374. border-radius: 35rpx;
  375. padding: 20rpx 70rpx;
  376. margin: 0 15rpx 65rpx;
  377. }
  378. .active {
  379. background: #FFA298;
  380. }
  381. }
  382. .popupBox_btn {
  383. display: flex;
  384. justify-content: space-between;
  385. padding: 0 30rpx 60rpx;
  386. view {
  387. width: 285rpx;
  388. height: 88rpx;
  389. border-radius: 20rpx;
  390. font-size: 32rpx;
  391. text-align: center;
  392. line-height: 88rpx;
  393. }
  394. .popupBox_btn_cel {
  395. color: #E83A27;
  396. border: 1rpx solid #e83a27;
  397. }
  398. .popupBox_btn_sub {
  399. background: #E83A27;
  400. color: #fff;
  401. }
  402. }
  403. }
  404. .loadmoreBox {
  405. padding-bottom: 1rpx;
  406. }
  407. .sortPad {
  408. padding: 20rpx 56rpx !important;
  409. }
  410. .ml10 {
  411. margin-left: 10rpx;
  412. }
  413. /deep/ .u-image__loading{
  414. height: 180rpx !important;
  415. }
  416. .loading{
  417. width: 160rpx;
  418. height: 160rpx;
  419. }
  420. </style>