pk-list.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view class="pk-list">
  3. <view class="index-bg"></view>
  4. <view class="search-box u-flex u-row-between" @click="tosearch">
  5. <u-icon name="search" color="#CCCCCC" size="36"></u-icon>
  6. <input type="text" placeholder="搜索楼盘" class="input" :disabled="true">
  7. <text class="text">搜索</text>
  8. </view>
  9. <view class="pk-box">
  10. <view class="box-title">
  11. 全部楼盘
  12. </view>
  13. <u-checkbox-group active-color="#1E7DFF" shape="circle" @change="changepk">
  14. <view class="pk-item u-flex u-row-between" v-for="(item,index) in list" :key="index">
  15. <image :src="item.logo" class="pk-img" mode="aspectFill"></image>
  16. <view class="pk-center u-flex-1">
  17. <u-icon name="trash" class="del-btn" @click="del(index)"></u-icon>
  18. <view class="item-name u-line-1">
  19. {{item.name}}
  20. </view>
  21. <view class="item-tips">
  22. <text class="u-line-1" style="white-space: nowrap;" v-if="item.house_type">{{item.house_type.join('·')}}·</text>
  23. <text style="white-space: nowrap;">{{item.house_min_area || 0}}-{{item.house_max_area || 0}}㎡</text>
  24. </view>
  25. <view class="item-tips">
  26. {{item.area}}
  27. </view>
  28. <view class="price-box u-flex">
  29. <text>参考均价</text>
  30. <text>{{item.avg_price}}元/㎡</text>
  31. </view>
  32. <view class="u-flex label-box">
  33. <text v-for="(a,b) in item.trait" :key="b" v-if="b < 2">{{a}}</text>
  34. </view>
  35. </view>
  36. <u-checkbox :name="item.id" v-model="item.checked"></u-checkbox>
  37. </view>
  38. </u-checkbox-group>
  39. <view style="height: 60vh;" v-if="list.length == 0">
  40. <u-empty text="请点击上方搜索楼盘" mode="list"></u-empty>
  41. </view>
  42. </view>
  43. <view class="" style="height: 170rpx;"></view>
  44. <view class="pk-down-btn u-flex u-row-between">
  45. <text @click="clear">重置</text>
  46. <text @click="toinfo">PK</text>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. value: false,
  55. list: [],
  56. ids: [],
  57. title: ''
  58. }
  59. },
  60. onLoad(option) {
  61. this.title = option.title
  62. },
  63. onShow() {
  64. this.list = uni.getStorageSync("pklist") || []
  65. this.list.forEach(val => {
  66. val.checked = false
  67. })
  68. this.list = JSON.parse(JSON.stringify(this.list))
  69. if (this.title) {
  70. uni.setNavigationBarTitle({
  71. title: this.title
  72. })
  73. }
  74. },
  75. methods: {
  76. del(index) {
  77. uni.showModal({
  78. content: "确定删除?",
  79. success: (e) => {
  80. if (e.confirm) {
  81. this.$u.toast("删除成功")
  82. this.list.splice(index, 1)
  83. uni.setStorageSync("pklist", this.list)
  84. this.clear()
  85. }
  86. }
  87. })
  88. },
  89. clear() {
  90. this.ids = []
  91. this.list.forEach(val => {
  92. val.checked = false
  93. })
  94. },
  95. changepk(e) {
  96. this.ids = e
  97. },
  98. toinfo() {
  99. if (this.ids.length < 2) {
  100. this.$u.toast("至少选择两项")
  101. return
  102. }
  103. if (this.ids.length > 3) {
  104. this.$u.toast("至多选择三项")
  105. return
  106. }
  107. uni.navigateTo({
  108. url: "./pk-info?ids=" + JSON.stringify(this.ids)
  109. })
  110. },
  111. tosearch() {
  112. uni.navigateTo({
  113. url: "./pk-search"
  114. })
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss">
  120. page {
  121. background-color: #F6F6F6;
  122. }
  123. .pk-list {
  124. position: relative;
  125. z-index: 1;
  126. padding: 1rpx 0;
  127. .pk-down-btn {
  128. width: 750rpx;
  129. height: 166rpx;
  130. background: #FFFFFF;
  131. position: fixed;
  132. bottom: 0;
  133. left: 0;
  134. padding: 0 24rpx 54rpx 24rpx;
  135. z-index: 10;
  136. text:first-child {
  137. width: 338rpx;
  138. line-height: 84rpx;
  139. background: #B2B2B2;
  140. border-radius: 20rpx;
  141. text-align: center;
  142. font-size: 28rpx;
  143. font-family: PingFangSC-Regular, PingFang SC;
  144. font-weight: 400;
  145. color: #FFFFFF;
  146. }
  147. text:last-child {
  148. width: 338rpx;
  149. line-height: 84rpx;
  150. background: #FFA120;
  151. border-radius: 20rpx;
  152. text-align: center;
  153. font-size: 28rpx;
  154. font-family: PingFangSC-Regular, PingFang SC;
  155. font-weight: 400;
  156. color: #FFFFFF;
  157. }
  158. }
  159. .pk-box {
  160. width: 702rpx;
  161. // height: 1760rpx;
  162. background: #FFFFFF;
  163. border-radius: 20rpx;
  164. margin: 0 auto 20rpx auto;
  165. padding: 0 20rpx;
  166. .pk-item {
  167. margin-bottom: 32rpx;
  168. position: relative;
  169. .del-btn {
  170. position: absolute;
  171. top: 20rpx;
  172. right: 0;
  173. z-index: 10;
  174. }
  175. .pk-img {
  176. width: 280rpx;
  177. height: 240rpx;
  178. border-radius: 20rpx;
  179. margin-right: 20rpx;
  180. }
  181. .pk-center {
  182. .label-box {
  183. text {
  184. margin-right: 10rpx;
  185. padding: 0 12rpx;
  186. line-height: 40rpx;
  187. height: 40rpx;
  188. background: #F5F5F5;
  189. border-radius: 8rpx;
  190. font-size: 18rpx;
  191. font-family: PingFangSC-Regular, PingFang SC;
  192. font-weight: 400;
  193. color: #999999;
  194. }
  195. }
  196. .price-box {
  197. margin-bottom: 8rpx;
  198. text:first-child {
  199. font-size: 20rpx;
  200. font-family: PingFangSC-Regular, PingFang SC;
  201. font-weight: 400;
  202. color: #999999;
  203. margin-right: 8rpx;
  204. }
  205. text:last-child {
  206. font-size: 32rpx;
  207. font-family: DINAlternate-Bold, DINAlternate;
  208. font-weight: bold;
  209. color: #FF3B30;
  210. }
  211. }
  212. .item-name {
  213. font-size: 28rpx;
  214. font-family: PingFangSC-Regular, PingFang SC;
  215. font-weight: 400;
  216. color: #131415;
  217. margin: 10rpx 0;
  218. min-width: 1rpx;
  219. }
  220. .item-tips {
  221. font-size: 18rpx;
  222. font-family: PingFangSC-Regular, PingFang SC;
  223. font-weight: 400;
  224. color: #999999;
  225. margin-bottom: 12rpx;
  226. }
  227. }
  228. }
  229. .box-title {
  230. padding: 24rpx 0;
  231. font-size: 34rpx;
  232. font-family: PingFangSC-Medium, PingFang SC;
  233. font-weight: 500;
  234. color: #131415;
  235. }
  236. }
  237. .search-box {
  238. width: 702rpx;
  239. height: 72rpx;
  240. background: #FFFFFF;
  241. border-radius: 20rpx;
  242. margin: 24rpx auto;
  243. padding-left: 24rpx;
  244. .input {
  245. flex: 1;
  246. margin: 0 10rpx;
  247. }
  248. .text {
  249. padding: 0 24rpx;
  250. border-left: 1rpx solid #E5E7ED;
  251. line-height: 36rpx;
  252. font-size: 28rpx;
  253. font-family: PingFangSC-Medium, PingFang SC;
  254. font-weight: 500;
  255. color: #1E7DFF;
  256. }
  257. }
  258. .index-bg {
  259. position: absolute;
  260. top: 0;
  261. left: 0;
  262. width: 750rpx;
  263. height: 556rpx;
  264. background: linear-gradient(180deg, #1E7DFF 0%, #F6F6F6 100%);
  265. z-index: -1;
  266. }
  267. }
  268. </style>