list.vue 6.7 KB

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