list.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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. if (item.activity_type == 2) {
  99. uni.navigateTo({
  100. url: `/pages/agent/activity/join2?id=${item.id}`
  101. })
  102. } else {
  103. uni.navigateTo({
  104. url: `/pages/agent/activity/join?id=${item.id}`
  105. })
  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.cust.apiactivitylist({
  157. page: that.loadmore.currnetPage,
  158. ...params,
  159. }).then(res => {
  160. const list = res.list || []
  161. if (list.length < 10) {
  162. that.loadmore.status = 'nomore';
  163. }
  164. if (res.current_page === 1) {
  165. if (list.length === 0) {
  166. uni.$msg('无搜索结果', 'none');
  167. }
  168. that.dataList = [...list]
  169. } else {
  170. that.dataList = that.dataList.concat(list)
  171. }
  172. if (bc) bc()
  173. })
  174. },
  175. customBack() {
  176. uni.navigateBack();
  177. },
  178. // 带监听器跳转
  179. pageTo(url, data) {
  180. /// xxxxx
  181. uni.navigateTo({
  182. url: url,
  183. events: {
  184. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  185. update: function(data) {
  186. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  187. }
  188. },
  189. success: function(res) {
  190. // 通过eventChannel向被打开页面传送数据
  191. res.eventChannel.emit('data', data);
  192. }
  193. });
  194. },
  195. searchHandle() {
  196. this.loadmore.currnetPage = 1
  197. this.getDataList(() => {
  198. this.searchPopupShow = false
  199. })
  200. },
  201. getTime(n) {
  202. let date = n ? new Date(n) : new Date()
  203. let year = date.getFullYear()
  204. let month = date.getMonth() + 1
  205. month = month > 9 ? month : '0' + month
  206. let day = date.getDate()
  207. day = day > 9 ? day : '0' + day
  208. let hour = date.getHours()
  209. hour = hour > 9 ? hour : '0' + hour
  210. let minute = date.getMinutes()
  211. minute = minute > 9 ? minute : '0' + minute
  212. let second = date.getSeconds()
  213. second = second > 9 ? second : '0' + second
  214. return `${year}-${month}-${day} ${hour}:${minute}:${second}`
  215. },
  216. }
  217. };
  218. </script>
  219. <style lang="scss">
  220. // 列表
  221. .scoped-estate-list {
  222. .sel-item {
  223. display: flex;
  224. border-bottom: 1PX solid #dcdcdc;
  225. padding: 20rpx;
  226. &.cur {
  227. background: #369af7;
  228. .img {
  229. opacity: .6;
  230. }
  231. .p1 {
  232. color: #fff;
  233. }
  234. .p3 {
  235. color: #fff;
  236. }
  237. }
  238. }
  239. .sel-left {
  240. width: 180rpx;
  241. border-radius: 10rpx;
  242. .img {
  243. width: 180rpx;
  244. height: 120rpx;
  245. border-radius: 10rpx;
  246. }
  247. }
  248. .sel-right {
  249. // width: 450rpx;
  250. margin-left: 20rpx;
  251. .p1 {
  252. font-size: 30rpx;
  253. font-weight: bold;
  254. margin-bottom: 10rpx;
  255. }
  256. .p2 {
  257. margin-bottom: 10rpx;
  258. }
  259. .p3 {
  260. color: #369af7;
  261. font-size: 26rpx;
  262. font-weight: bold;
  263. }
  264. }
  265. }
  266. .float-search {
  267. opacity: 0.9;
  268. position: fixed;
  269. right: 20rpx;
  270. bottom: 40rpx;
  271. padding: 20rpx;
  272. border-radius: 50%;
  273. background-color: $u-theme-color;
  274. }
  275. .scoped-list-more-info {
  276. position: absolute;
  277. right: 20rpx;
  278. }
  279. </style>