addProperties.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <view style="padding-top: 20rpx;">
  3. <view class="main-left cross-center search">
  4. <image src="https://t17.9026.com/web/statics/image/index/search.png" mode=""></image>
  5. <input style="width: 560rpx;" type="text" v-model="name" placeholder="搜索楼盘"
  6. placeholder-style="font-size:28rpx;color:#999;" @input="search" />
  7. </view>
  8. <view class="properties_list">
  9. <view class="item main-left" v-for="(item,index) in dataList" :key="index" @click="selectEstate(index,item.name,item.id,item)">
  10. <view class="left">
  11. <image :src="item.cover_img" mode=""></image>
  12. </view>
  13. <view class="main-between-y right ">
  14. <view class="title">{{item.name}}</view>
  15. <view class="addr">{{item.address}}</view>
  16. <view class="content t-omit-two" v-html="item.details"></view>
  17. </view>
  18. <image class="bg" src="https://t17.9026.com/web/statics/image/sale/properties_gradual.png" mode="">
  19. </image>
  20. </view>
  21. <view class="no-more" v-if="noMore">没有更多了...</view>
  22. <app-no-goods v-if="dataList.length === 0" :title="'暂无数据'" background="#f7f7f7"></app-no-goods>
  23. </view>
  24. <u-popup v-model="show" mode="center" border-radius="14" @close="show = false">
  25. <view class="model">
  26. <viwe class="main-right">
  27. <image src="https://t17.9026.com/web/statics/image/index/close.png" mode=""
  28. style="width: 25rpx;height: 24rpx;" @click="show=false"></image>
  29. </viwe>
  30. <viwe class="title">{{dataList[selectIndex].name}}</viwe>
  31. <viwe class="main-left cross-center addr">
  32. <image src="https://t17.9026.com/web/statics/image/index/location.png" mode=""
  33. style="width: 18rpx;height: 20rpx;margin-right: 8rpx;"></image>
  34. {{dataList[selectIndex].address}}
  35. </viwe>
  36. <viwe class="img">
  37. <image class="img" :src="dataList[selectIndex].cover_img" mode=""></image>
  38. </viwe>
  39. <viwe class="desc t-omit-three" v-html="dataList[selectIndex].details"></viwe>
  40. <button type="default" class="btn" @click="bindingEstate">确认选择</button>
  41. </view>
  42. </u-popup>
  43. </view>
  44. </template>
  45. <script>
  46. import appNoGoods from '@/components/page-component/app-no-goods/app-no-goods.vue';
  47. import uPopup from '@/components/basic-component/u-popup/u-popup.vue';
  48. export default {
  49. components: {
  50. appNoGoods,
  51. uPopup
  52. },
  53. data() {
  54. return {
  55. type:'',
  56. show: false,
  57. page:1,
  58. name:'',
  59. dataList:[],
  60. noMore:false,
  61. selectIndex:-1,
  62. regionId:{},
  63. };
  64. },
  65. onLoad(option) {
  66. 'regionId' in option?this.regionId=JSON.parse(option.regionId):''
  67. 'type' in option?this.type=option.type:''
  68. this.getData(1)
  69. },
  70. methods:{
  71. selectEstate(index,name,id,item){
  72. let pages = getCurrentPages();
  73. let currPage = pages[pages.length - 1]; //当前页面
  74. let prevPage = pages[pages.length - 2]; //上一个页面
  75. let multiIndex=[item.province_id,item.city_id,item.district_id]
  76. prevPage.$vm.estateInfo={id:id,name:name,multiIndex:multiIndex,address:item.address,property:item.property}
  77. this.selectIndex=index
  78. this.show=true
  79. },
  80. bindingEstate(){
  81. let pages = getCurrentPages();
  82. let prevPage = pages[pages.length - 2]; //上一个页面
  83. if(prevPage.route==='pages/sale/properties/properties'){
  84. this.$request({
  85. url: this.$api.sale.binding_estate,
  86. data: {
  87. estate_id:this.dataList[this.selectIndex].id
  88. },
  89. method: 'post'
  90. }).then(res=>{
  91. uni.showToast({
  92. icon:res.code===0?'success':'none',
  93. title:res.msg
  94. })
  95. this.show=false
  96. })
  97. }else{
  98. uni.navigateBack()
  99. }
  100. },
  101. search(e){
  102. this.$utils.debounce(()=>{
  103. this.getData(1)
  104. },800)
  105. },
  106. getData(page){
  107. this.$request({
  108. url: this.$api.sale.estate_list,
  109. data: {
  110. page: page,
  111. is_myself: 0,
  112. name: this.name,
  113. ...this.regionId
  114. },
  115. method: 'post'
  116. }).then(res=>{
  117. if(res.code===0){
  118. if(this.page===1){
  119. this.dataList=res.data.list
  120. }else{
  121. this.dataList=this.dataList.concat(res.data.list)
  122. }
  123. if(res.data.list.length<20){
  124. this.noMore=true
  125. }
  126. }
  127. })
  128. }
  129. },
  130. onReachBottom() {
  131. if(!noMore){
  132. this.page++
  133. this.getData(this.page)
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss" scoped>
  139. .model {
  140. width: 626rpx;
  141. height: 839rpx;
  142. background: #FFFFFF;
  143. border-radius: 14rpx;
  144. padding: 37rpx 49rpx;
  145. .title {
  146. font-size: 36rpx;
  147. font-weight: bold;
  148. color: #222222;
  149. }
  150. .addr {
  151. font-size: 22rpx;
  152. font-weight: 500;
  153. color: #999999;
  154. margin-top: 20rpx;
  155. }
  156. .img {
  157. width: 528rpx;
  158. height: 311rpx;
  159. border-radius: 14rpx;
  160. margin-top: 28rpx;
  161. }
  162. .desc {
  163. font-size: 26rpx;
  164. font-weight: 500;
  165. color: #222222;
  166. line-height: 36rpx;
  167. margin-top: 36rpx;
  168. max-height: 100rpx;
  169. }
  170. .btn {
  171. width: 525rpx;
  172. height: 85rpx;
  173. background: #A18353;
  174. border-radius: 6rpx;
  175. margin: 49rpx auto;
  176. font-size: 32rpx;
  177. font-weight: bold;
  178. color: #FFFFFF;
  179. }
  180. }
  181. .page {
  182. padding: 22rpx 0 0 0;
  183. min-height: 100vh;
  184. }
  185. .search {
  186. width: 680rpx;
  187. height: 82rpx;
  188. background: #FFFFFF;
  189. border: 1rpx solid #EEEEEE;
  190. border-radius: 4rpx;
  191. margin: 0 auto;
  192. padding-left: 22rpx;
  193. image {
  194. width: 22rpx;
  195. height: 22rpx;
  196. margin-right: 18rpx;
  197. }
  198. }
  199. .properties_list {
  200. background-color: #F8F8F8;
  201. .item {
  202. font-family: PingFang SC;
  203. margin: 25rpx auto;
  204. width: 678rpx;
  205. height: 206rpx;
  206. background: #FFFFFF;
  207. border-radius: 10rpx;
  208. // background-image: url(https://t17.9026.com/web/statics/image/sale/properties_gradual.png);
  209. padding: 25rpx;
  210. position: relative;
  211. .bg {
  212. position: absolute;
  213. top: 0;
  214. left: 0;
  215. width: 80%;
  216. height: 100%;
  217. }
  218. .left {
  219. image {
  220. width: 153rpx;
  221. height: 153rpx;
  222. border-radius: 10rpx;
  223. }
  224. }
  225. .right {
  226. margin-left: 25rpx;
  227. .title {
  228. font-size: 30rpx;
  229. font-weight: bold;
  230. color: #222222;
  231. }
  232. .addr {
  233. font-size: 22rpx;
  234. font-weight: 500;
  235. color: #222222;
  236. }
  237. .content {
  238. font-size: 24rpx;
  239. font-weight: 500;
  240. color: #666666;
  241. line-height: 34rpx;
  242. }
  243. }
  244. }
  245. .addPro {
  246. position: fixed;
  247. bottom: 0;
  248. width: 100%;
  249. height: 100rpx;
  250. background: #A18353;
  251. font-size: 32rpx;
  252. font-family: PingFang SC;
  253. font-weight: bold;
  254. color: #FFFFFF;
  255. }
  256. }
  257. .no-more {
  258. font-size: 24rpx;
  259. font-weight: 500;
  260. color: #666666;
  261. margin-top: 37rpx;
  262. text-align: center;
  263. }
  264. </style>