addProperties.vue 6.6 KB

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