list.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <view>
  3. <wm-watermark :text="userInfo2.phone" :num="50"></wm-watermark>
  4. <view class="scoped-estate-list">
  5. <view v-for="(item, index) in dataList" :class="curEid == item.id ? 'sel-item cur' : 'sel-item'" @click="listItemHandle(item)" :key="index">
  6. <view class="sel-left">
  7. <image class="img" :src="item.pri_image" mode="aspectFill"></image>
  8. </view>
  9. <view class="sel-right">
  10. <view class="p1">{{item.estate_name}}{{item.report_open == 2 ? '[上架中]' : ''}}{{curEid == item.id ? '【已选中】' : ''}}</view>
  11. <view class="p2">
  12. <u-tag
  13. :text="areaTypeObj[item.area_type]"
  14. :type="'success'"
  15. size="mini"
  16. ></u-tag>
  17. </view>
  18. <view class="p3" v-if="userInfo2.auth_state == 1">预计奖励:{{ item.brokerage }}</view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="float-search" @click="searchPopupShow = true"><u-icon name="search" size="42" color="#fff"></u-icon></view>
  23. <!-- 平台佣金政策弹窗 -->
  24. <u-popup v-model="searchPopupShow" mode="center" width="80%" height="440rpx" border-radius="20">
  25. <view class="bwin-popup">
  26. <view class="popup-header">楼盘搜索</view>
  27. <view class="popup-body">
  28. <u-input v-model="searchFormData.estate_name" border placeholder="请输入楼盘名称(支持模糊搜索)"></u-input>
  29. <!-- <u-divider marginTop="10" marginBottom="10">或</u-divider>
  30. <u-input v-model="searchFormData.phone" border placeholder="请输入手机号(可仅输入一部分)"></u-input> -->
  31. </view>
  32. <view class="popup-footer" style="position: absolute;">
  33. <u-button size="medium" @click="searchPopupShow = false">取消</u-button>
  34. <u-button size="medium" type="primary" @click="searchHandle()">搜索</u-button>
  35. </view>
  36. </view>
  37. </u-popup>
  38. <u-loadmore
  39. v-if="dataList.length > 0"
  40. marginTop="32"
  41. :line="true"
  42. :status="loadmore.status"
  43. :loading-text="loadmore.loadingText"
  44. :loadmore-text="loadmore.defaultText"
  45. :nomore-text="loadmore.nomoreText"
  46. />
  47. </view>
  48. </template>
  49. <script>
  50. import { arrToObj } from '@/utils'
  51. import wmWatermark from '@/components/wm-watermark/wm-watermark.vue'
  52. import uniCopy from '@/js_sdk/xb-copy/uni-copy.js'
  53. export default {
  54. components: {
  55. wmWatermark
  56. },
  57. data() {
  58. return {
  59. searchKeyword: null,
  60. searchPopupShow: false,
  61. searchFormData: {
  62. name: '',
  63. phone: ''
  64. }, // 搜索栏数据
  65. orderMethod: 0,
  66. filterDropdownValue: {}, // 默认筛选
  67. dataList: [], // 客户列表
  68. loadmore: {
  69. status: 'loadmore',
  70. loadingText: '努力加载中',
  71. defaultText: '轻轻上拉 查看更多',
  72. nomoreText: '实在没有了',
  73. currnetPage: 1
  74. },
  75. curRoles: '',
  76. userInfo2: {},
  77. areaTypeObj: {},
  78. curEid: '',
  79. curEname: '',
  80. };
  81. },
  82. onLoad(params) {
  83. if (params.eid) {
  84. this.curEid = params.eid
  85. this.curEname = params.enames
  86. }
  87. this.getDataList()
  88. this.userInfo2 = uni.getStorageSync('MD_userInfo2')
  89. this.curRoles = uni.getStorageSync('MD_userInfo2') ? uni.getStorageSync('MD_userInfo2').roles : ''
  90. const dictObj = uni.getStorageSync('MD_dict')
  91. this.areaTypeObj = arrToObj(dictObj.area_type)
  92. },
  93. onReachBottom() {
  94. if (this.loadmore.status == 'nomore') return;
  95. this.loadmore.currnetPage++
  96. this.getDataList()
  97. },
  98. onPullDownRefresh() {
  99. // 防止频繁刷新
  100. },
  101. methods: {
  102. listItemHandle (item) {
  103. if (this.userInfo2 && this.userInfo2.auth_state == 1) {
  104. uni.navigateTo({
  105. url: `/pages/estate/dtl?id=${item.id}`
  106. })
  107. }
  108. // if (this.curEid) {
  109. // this.curEid = item.id
  110. // } else {
  111. // if (this.userInfo2 && this.userInfo2.auth_state == 1) {
  112. // uni.navigateTo({
  113. // url: `/pages/estate/dtl?id=${item.id}`
  114. // })
  115. // }
  116. // }
  117. },
  118. copyTextHandle (item) {
  119. uniCopy({
  120. content: `${item.name}-${item.sex == 'male'?'男':'女'}-${item.phone}`,
  121. success:(res)=>{
  122. uni.showToast({
  123. title: res,
  124. icon: 'none'
  125. })
  126. },
  127. error:(e)=>{
  128. uni.showToast({
  129. title: e,
  130. icon: 'none',
  131. duration:3000,
  132. })
  133. }
  134. })
  135. },
  136. getDataList (bc) {
  137. const that = this
  138. let params = {
  139. // page_size: 1000,
  140. ...this.searchFormData
  141. }
  142. if (that.orderMethod > 0) {
  143. if (that.orderMethod === 1) {
  144. params.order_by = JSON.stringify([{
  145. field: 'create_at',
  146. sort: 'desc',
  147. }])
  148. }
  149. if (that.orderMethod === 2) {
  150. params.order_by = JSON.stringify([{
  151. field: 'create_at',
  152. sort: 'asc',
  153. }])
  154. }
  155. }
  156. uni.api.estate.apiestatelist({
  157. page: that.loadmore.currnetPage,
  158. is_inner: 2,
  159. ...params,
  160. }).then(res => {
  161. const list = res.list || []
  162. if (list.length < 10) {
  163. that.loadmore.status = 'nomore';
  164. }
  165. if (res.current_page === 1) {
  166. if (list.length === 0) {
  167. uni.$msg('无搜索结果', 'none');
  168. }
  169. that.dataList = [...list]
  170. } else {
  171. that.dataList = that.dataList.concat(list)
  172. }
  173. if (bc) bc()
  174. })
  175. },
  176. customBack() {
  177. uni.navigateBack();
  178. },
  179. // 带监听器跳转
  180. pageTo(url, data) {
  181. /// xxxxx
  182. uni.navigateTo({
  183. url: url,
  184. events: {
  185. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  186. update: function(data) {
  187. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  188. }
  189. },
  190. success: function(res) {
  191. // 通过eventChannel向被打开页面传送数据
  192. res.eventChannel.emit('data', data);
  193. }
  194. });
  195. },
  196. searchHandle() {
  197. this.loadmore.currnetPage = 1
  198. this.getDataList(() => {
  199. this.searchPopupShow = false
  200. })
  201. },
  202. getTime(n) {
  203. let date = n ? new Date(n) : new Date()
  204. let year = date.getFullYear()
  205. let month = date.getMonth() + 1
  206. month = month > 9 ? month : '0' + month
  207. let day = date.getDate()
  208. day = day > 9 ? day : '0' + day
  209. let hour = date.getHours()
  210. hour = hour > 9 ? hour : '0' + hour
  211. let minute = date.getMinutes()
  212. minute = minute > 9 ? minute : '0' + minute
  213. let second = date.getSeconds()
  214. second = second > 9 ? second : '0' + second
  215. return `${year}-${month}-${day} ${hour}:${minute}:${second}`
  216. },
  217. }
  218. };
  219. </script>
  220. <style lang="scss">
  221. // 列表
  222. .scoped-estate-list {
  223. .sel-item {
  224. display: flex;
  225. border-bottom: 1PX solid #dcdcdc;
  226. padding: 20rpx;
  227. &.cur {
  228. background: #369af7;
  229. .img {
  230. opacity: .6;
  231. }
  232. .p1 {
  233. color: #fff;
  234. }
  235. .p3 {
  236. color: #fff;
  237. }
  238. }
  239. }
  240. .sel-left {
  241. width: 180rpx;
  242. border-radius: 10rpx;
  243. .img {
  244. width: 180rpx;
  245. height: 120rpx;
  246. border-radius: 10rpx;
  247. }
  248. }
  249. .sel-right {
  250. // width: 450rpx;
  251. margin-left: 20rpx;
  252. .p1 {
  253. font-size: 30rpx;
  254. font-weight: bold;
  255. margin-bottom: 10rpx;
  256. }
  257. .p2 {
  258. margin-bottom: 10rpx;
  259. }
  260. .p3 {
  261. color: #369af7;
  262. font-size: 26rpx;
  263. font-weight: bold;
  264. }
  265. }
  266. }
  267. .float-search {
  268. opacity: 0.9;
  269. position: fixed;
  270. right: 20rpx;
  271. bottom: 40rpx;
  272. padding: 20rpx;
  273. border-radius: 50%;
  274. background-color: $u-theme-color;
  275. }
  276. .scoped-list-more-info {
  277. position: absolute;
  278. right: 20rpx;
  279. }
  280. </style>