gf-search.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <view class="gf-search">
  3. <u-popup v-model="show" mode="right">
  4. <view class="search-popup">
  5. <view class="search-item">
  6. <view class="search-title">
  7. 区域筛选
  8. </view>
  9. <view class="u-flex">
  10. <view class="select-box0 u-flex u-row-between" @click="showsheng = true">
  11. <text class="text u-line-1">{{shengname || '选择省'}}</text>
  12. <u-icon name="arrow-down" color="#D8D8D8" size="26"></u-icon>
  13. </view>
  14. <view class="select-box0 u-flex u-row-between" @click="showshi = true">
  15. <text class="text u-line-1">{{shiname || '选择市'}}</text>
  16. <u-icon name="arrow-down" color="#D8D8D8" size="26"></u-icon>
  17. </view>
  18. <view class="select-box0 u-flex u-row-between" @click="showqu = true">
  19. <text class="text u-line-1">{{quname || '选择区'}}</text>
  20. <u-icon name="arrow-down" color="#D8D8D8" size="26"></u-icon>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="search-item">
  25. <view class="search-title">
  26. 价格筛选
  27. </view>
  28. <view class="select-box1 u-flex">
  29. <text :class="price == 1 ? 'text1 text1_active' : 'text1'" @click="price = 1">从低到高</text>
  30. <text :class="price == 2 ? 'text1 text1_active' : 'text1'" @click="price = 2">从高到低</text>
  31. </view>
  32. </view>
  33. <view class="search-item">
  34. <view class="search-title">
  35. 面积筛选
  36. </view>
  37. <view class="select-box2 u-flex">
  38. <view class="text1 u-flex">
  39. <input type="number" placeholder="请输入" v-model="mianji1">
  40. <text>㎡</text>
  41. </view>
  42. <text class="xian"></text>
  43. <view class="text1 u-flex">
  44. <input type="number" placeholder="请输入" v-model="mianji2">
  45. <text>㎡</text>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="search-item">
  50. <view class="search-title">
  51. 户型筛选
  52. </view>
  53. <view class="select-box u-flex u-row-between" @click="showhuxing = true">
  54. <text class="text">{{huxingname || '请选择'}}</text>
  55. <u-icon name="arrow-down" color="#D8D8D8" size="26"></u-icon>
  56. </view>
  57. </view>
  58. <view class="search-item">
  59. <view class="search-title">
  60. 类别筛选
  61. </view>
  62. <view class="select-box u-flex u-row-between" @click="showleibie = true">
  63. <text class="text">{{leibiename || '请选择'}}</text>
  64. <u-icon name="arrow-down" color="#D8D8D8" size="26"></u-icon>
  65. </view>
  66. </view>
  67. <view class="u-flex search-btn u-row-between">
  68. <text @click="chongzhi">重置</text>
  69. <text @click="shaixuan">确定</text>
  70. </view>
  71. </view>
  72. </u-popup>
  73. <u-select v-model="showsheng" :list="shenglist" label-name="name" value-name="id" @confirm="changesheng"></u-select>
  74. <u-select v-model="showshi" :list="shilist" label-name="name" value-name="id" @confirm="changeshi"></u-select>
  75. <u-select v-model="showqu" :list="qulist" label-name="name" value-name="id" @confirm="changequ"></u-select>
  76. <u-select v-model="showhuxing" :list="huxinglist" label-name="title" value-name="id" @confirm="changehuxing"></u-select>
  77. <u-select v-model="showleibie" :list="leibielist" label-name="title" @confirm="changeleibie"></u-select>
  78. </view>
  79. </template>
  80. <script>
  81. export default {
  82. data() {
  83. return {
  84. show: false,
  85. showsheng: false,
  86. shenglist: [],
  87. shengname: '',
  88. shengid: '',
  89. showshi: false,
  90. shilist: [],
  91. shiname: '',
  92. shiid: '',
  93. showqu: false,
  94. qulist: [],
  95. quname: '',
  96. quid: '',
  97. price: '',
  98. mianji1: '',
  99. mianji2: '',
  100. showhuxing: false,
  101. huxinglist: [],
  102. huxingname: '',
  103. huxingid: '',
  104. showleibie: false,
  105. leibielist: [],
  106. leibiename: '',
  107. }
  108. },
  109. created() {
  110. this.getconfig()
  111. },
  112. methods: {
  113. shaixuan() {
  114. if(this.shengid && !this.quid){
  115. this.$u.toast("请选择完整区域")
  116. return
  117. }
  118. if ((this.mianji1 && this.mianji2) || (!this.mianji1 && !this.mianji2)) {
  119. this.$emit('shaixuan', {
  120. area_id: this.quid,
  121. price_sort: this.price,
  122. min_area: this.mianji1,
  123. max_area: this.mianji2,
  124. house_type_id: this.huxingid,
  125. property_class: this.leibiename
  126. })
  127. this.show = false
  128. } else {
  129. this.$u.toast("面积有误")
  130. }
  131. },
  132. chongzhi() {
  133. this.shengid = ''
  134. this.shengname = ''
  135. this.shiid = ''
  136. this.shiname = ''
  137. this.quid = ''
  138. this.quname = ''
  139. this.price = ''
  140. this.mianji1 = ''
  141. this.mianji2 = ''
  142. this.huxingid = ''
  143. this.huxingname = ''
  144. this.leibiename = ''
  145. this.show = false
  146. },
  147. changeleibie(e) {
  148. this.leibiename = e[0].label
  149. },
  150. changehuxing(e) {
  151. this.huxingname = e[0].label
  152. this.huxingid = e[0].value
  153. },
  154. changesheng(e) {
  155. this.shengname = e[0].label
  156. this.shengid = e[0].value
  157. this.shilist = []
  158. this.shiname = ''
  159. this.shiid = ''
  160. this.qulist = []
  161. this.quname = ''
  162. this.quid = ''
  163. this.$u.post('/api/Data/area_list', {
  164. level: 2,
  165. province_id: this.shengid
  166. }).then(res => {
  167. this.shilist = res.data
  168. })
  169. },
  170. changeshi(e) {
  171. this.shiname = e[0].label
  172. this.shiid = e[0].value
  173. this.qulist = []
  174. this.quname = ''
  175. this.quid = ''
  176. this.$u.post('/api/Data/area_list', {
  177. level: 3,
  178. city_id: this.shiid
  179. }).then(res => {
  180. this.qulist = res.data
  181. })
  182. },
  183. changequ(e) {
  184. this.quname = e[0].label
  185. this.quid = e[0].value
  186. },
  187. getconfig() {
  188. this.$u.post('/api/Data/area_list', {
  189. level: 1
  190. }).then(res => {
  191. this.shenglist = res.data
  192. })
  193. this.$u.post('/api/Index/house_type_list').then(res => {
  194. this.huxinglist = res.data
  195. })
  196. this.$u.post('/api/Index/property_class_list').then(res => {
  197. this.leibielist = res.data
  198. })
  199. }
  200. }
  201. }
  202. </script>
  203. <style lang="scss">
  204. .gf-search {
  205. .search-popup {
  206. width: 448rpx;
  207. background: #FFFFFF;
  208. padding: 0 24rpx;
  209. .search-btn {
  210. margin-top: 40rpx;
  211. text:first-child {
  212. width: 188rpx;
  213. line-height: 76rpx;
  214. background: #FFA120;
  215. border-radius: 8rpx;
  216. text-align: center;
  217. font-size: 22rpx;
  218. font-family: PingFangSC-Regular, PingFang SC;
  219. font-weight: 400;
  220. color: #FFFFFF;
  221. }
  222. text:last-child {
  223. width: 188rpx;
  224. line-height: 76rpx;
  225. background: #1F7EFF;
  226. border-radius: 8rpx;
  227. text-align: center;
  228. font-size: 22rpx;
  229. font-family: PingFangSC-Regular, PingFang SC;
  230. font-weight: 400;
  231. color: #FFFFFF;
  232. }
  233. }
  234. .search-item {
  235. padding: 40rpx 0 24rpx 0;
  236. border-bottom: 1rpx solid #F5F5F5;
  237. .select-box2 {
  238. .text1 {
  239. width: 128rpx;
  240. height: 52rpx;
  241. background: #FFFFFF;
  242. border-radius: 8rpx;
  243. border: 2rpx solid #CCCCCC;
  244. padding: 0 10rpx;
  245. input {
  246. flex: 1;
  247. text-align: center;
  248. font-size: 24rpx;
  249. }
  250. text {
  251. font-size: 22rpx;
  252. font-family: PingFangSC-Regular, PingFang SC;
  253. font-weight: 400;
  254. color: #CCCCCC;
  255. }
  256. }
  257. .xian {
  258. width: 32rpx;
  259. height: 2rpx;
  260. background: #CCCCCC;
  261. border-radius: 8rpx;
  262. margin: 0 10rpx;
  263. }
  264. }
  265. .select-box1 {
  266. .text1 {
  267. width: 128rpx;
  268. line-height: 52rpx;
  269. background: #FFFFFF;
  270. border-radius: 8rpx;
  271. border: 2rpx solid #CCCCCC;
  272. text-align: center;
  273. font-size: 22rpx;
  274. font-family: PingFangSC-Regular, PingFang SC;
  275. font-weight: 400;
  276. color: #CCCCCC;
  277. margin-right: 20rpx;
  278. }
  279. .text1_active {
  280. border: 2rpx solid #1F7EFF;
  281. color: #1F7EFF;
  282. }
  283. }
  284. .search-title {
  285. margin-bottom: 20rpx;
  286. font-size: 28rpx;
  287. font-family: PingFangSC-Regular, PingFang SC;
  288. font-weight: 400;
  289. color: #333333;
  290. }
  291. .select-box0 {
  292. flex: 1;
  293. height: 52rpx;
  294. background: #FFFFFF;
  295. border-radius: 8rpx;
  296. border: 2rpx solid #CCCCCC;
  297. padding: 0 5rpx;
  298. margin-right: 10rpx;
  299. .text {
  300. font-size: 24rpx;
  301. font-family: PingFangSC-Regular, PingFang SC;
  302. font-weight: 400;
  303. color: #333333;
  304. flex: 1;
  305. }
  306. }
  307. .select-box {
  308. width: 312rpx;
  309. height: 52rpx;
  310. background: #FFFFFF;
  311. border-radius: 8rpx;
  312. border: 2rpx solid #CCCCCC;
  313. padding: 0 14rpx;
  314. .text {
  315. font-size: 24rpx;
  316. font-family: PingFangSC-Regular, PingFang SC;
  317. font-weight: 400;
  318. color: #333333;
  319. flex: 1;
  320. }
  321. }
  322. }
  323. }
  324. }
  325. </style>