list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <view>
  3. <u-navbar
  4. :customBack="customBack"
  5. back-icon-color="#fff"
  6. title="报备列表"
  7. :background="{ backgroundColor: '#2080f0' }"
  8. title-color="#fff"
  9. :border-bottom="false"
  10. ></u-navbar>
  11. <!-- 顶部筛选栏 -->
  12. <HM-filterDropdown :menuTop="menuTop" :filterData="filterData" :defaultSelected="filterDropdownValue" @confirm="confirmFilter"></HM-filterDropdown>
  13. <view class="customer-list-wrap">
  14. <view v-if="customerList.length == 0" class="empty-wrap"><u-empty mode="list" text="暂无相关客户"></u-empty></view>
  15. <view v-for="(item, index) in customerList" class="customer-item" :key="index">
  16. <view class="info" @click="pageTo('/pages/agent/recommend/detail?id=' + item.id)">
  17. <view class="customer">
  18. <view class="relname">
  19. {{ item.name }}
  20. <u-icon
  21. class="u-m-l-5"
  22. :name="item.sex == 'male' ? 'man' : 'woman'"
  23. size="22"
  24. :color="item.sex == 'male' ? '#2080f0' : '#f85f69'"
  25. ></u-icon>
  26. </view>
  27. <view class="item">
  28. <u-icon class="u-m-r-5" name="phone" size="22"></u-icon>
  29. {{ item.phone }}
  30. </view>
  31. <view class="item">
  32. <u-icon class="u-m-r-5" name="home" size="22"></u-icon>
  33. {{ item.estate_name }}
  34. </view>
  35. <!-- <view class="item">
  36. <u-icon class="u-m-r-5" name="rmb" size="22"></u-icon>
  37. 预期最高收益{{ item.commission }}元
  38. </view> -->
  39. </view>
  40. <view class="data-wrap">
  41. <view class="date u-m-t-5">报备时间:{{item.create_at}}</view>
  42. <view class="date">保护期截止:{{item.lock_at}}</view>
  43. </view>
  44. </view>
  45. <view class="tool-wrap">
  46. <view class="tag">
  47. <u-tag
  48. :text="item.report_state == 3 ? '无效客户' : item.report_state == 2 ? '审核中' : '有效客户'"
  49. :type="item.report_state == 3 ? 'error' : item.report_state == 2 ? 'warning' : 'success'"
  50. size="mini"
  51. class="u-m-r-10"
  52. ></u-tag>
  53. <u-tag
  54. v-if="item.report_state == 1"
  55. :text="stepList[item.report_step]"
  56. :type="Number(item.report_step) > 1 ? 'success' : 'warning'"
  57. size="mini"
  58. ></u-tag>
  59. </view>
  60. <view class="scoped-list-more-info" v-if="curRoles == 1 || curRoles == 3 || curRoles == 5 || curRoles == 6">
  61. 报备人:{{item.create_user.nickname}}
  62. <u-tag
  63. style="margin-left: 10px;"
  64. text="复制"
  65. type="primary"
  66. size="mini"
  67. ></u-tag>
  68. </view>
  69. <view class="tool">
  70. <u-icon
  71. v-if="item.report_step <= 1 && item.expire_time == 0"
  72. name="reload"
  73. size="32"
  74. label="重新报备"
  75. label-size="24"
  76. @click="pageTo('/pages/agent/recommend/create', { info: item })"
  77. ></u-icon>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="float-search" @click="searchPopupShow = true"><u-icon name="search" size="42" color="#fff"></u-icon></view>
  83. <!-- 平台佣金政策弹窗 -->
  84. <u-popup v-model="searchPopupShow" mode="center" width="80%" height="440rpx" border-radius="20">
  85. <view class="bwin-popup">
  86. <view class="popup-header">客户搜索</view>
  87. <view class="popup-body">
  88. <u-input v-model="searchFormData.name" border placeholder="请输入客户姓名(支持模糊搜索)"></u-input>
  89. <u-divider marginTop="10" marginBottom="10">或</u-divider>
  90. <u-input v-model="searchFormData.phone" border placeholder="请输入客户手机号(可仅输入一部分)"></u-input>
  91. </view>
  92. <view class="popup-footer" style="position: absolute;">
  93. <u-button size="medium" @click="searchPopupShow = false">取消</u-button>
  94. <u-button size="medium" type="primary" @click="searchHandle()">搜索</u-button>
  95. </view>
  96. </view>
  97. </u-popup>
  98. <u-loadmore
  99. v-if="customerList.length > 0"
  100. marginTop="32"
  101. :line="true"
  102. :status="loadmore.status"
  103. :loading-text="loadmore.loadingText"
  104. :loadmore-text="loadmore.defaultText"
  105. :nomore-text="loadmore.nomoreText"
  106. />
  107. </view>
  108. </template>
  109. <script>
  110. var that;
  111. export default {
  112. data() {
  113. return {
  114. searchKeyword: null,
  115. searchPopupShow: false,
  116. searchFormData: {
  117. name: '',
  118. phone: ''
  119. }, // 搜索栏数据
  120. menuTop: 110, // 筛选栏距顶部距离
  121. filterData: [
  122. {
  123. name: '日期范围',
  124. type: 'hierarchy',
  125. submenu: [
  126. {
  127. name: '全部',
  128. value: 0
  129. },
  130. {
  131. name: '24小时内',
  132. value: 24
  133. },
  134. {
  135. name: '7天内',
  136. value: 168
  137. },
  138. {
  139. name: '30天内',
  140. value: 720
  141. }
  142. ]
  143. },
  144. {
  145. name: '意向项目',
  146. type: 'hierarchy',
  147. submenu: [
  148. {
  149. name: '全部',
  150. value: 999
  151. }
  152. ]
  153. },
  154. {
  155. name: '客户状态',
  156. type: 'hierarchy',
  157. submenu: [
  158. {
  159. name: '全部状态',
  160. value: 999
  161. },
  162. {
  163. name: '有效',
  164. value: 1
  165. },
  166. {
  167. name: '审核中',
  168. value: 2
  169. },
  170. {
  171. name: '无效',
  172. value: 3
  173. }
  174. ]
  175. },
  176. {
  177. name: '客户进度',
  178. type: 'hierarchy',
  179. submenu: [
  180. {
  181. name: '全部进度',
  182. value: 999
  183. },
  184. {
  185. name: '未到访',
  186. value: 1
  187. },
  188. {
  189. name: '已到访',
  190. value: 2
  191. },
  192. {
  193. name: '已认购',
  194. value: 3
  195. },
  196. {
  197. name: '已签约',
  198. value: 4
  199. },
  200. {
  201. name: '已结佣',
  202. value: 5
  203. }
  204. ]
  205. },
  206. {
  207. name: '排序',
  208. type: 'hierarchy',
  209. submenu: [
  210. {
  211. name: '时间近到远',
  212. value: 1
  213. },
  214. {
  215. name: '时间远到近',
  216. value: 2
  217. },
  218. // {
  219. // name: '预期佣金高到底',
  220. // value: 2
  221. // },
  222. // {
  223. // name: '预期佣金低到高',
  224. // value: 3
  225. // }
  226. ]
  227. }
  228. ],
  229. filterHours: 0,
  230. filterPropertyId: 999,
  231. filterVerifyStatus: 999,
  232. filterStepStatus: 999,
  233. orderMethod: 0,
  234. filterDropdownValue: {}, // 默认筛选
  235. customerList: [], // 客户列表
  236. stepList: ['审核中', '未到访', '已到访', '已认购', '已签约', '已结佣'],
  237. loadmore: {
  238. status: 'loadmore',
  239. loadingText: '努力加载中',
  240. defaultText: '轻轻上拉 查看更多',
  241. nomoreText: '实在没有了',
  242. currnetPage: 1
  243. },
  244. curRoles: '',
  245. };
  246. },
  247. onLoad(params) {
  248. that = this;
  249. // #ifdef H5
  250. that.menuTop = 88;
  251. // #endif
  252. // #ifdef MP
  253. let systemInfo = wx.getSystemInfoSync();
  254. //状态栏高度
  255. let statusBarHeight = Number(systemInfo.statusBarHeight);
  256. let menu = wx.getMenuButtonBoundingClientRect();
  257. //导航栏高度
  258. let navBarHeight = menu.height + (menu.top - statusBarHeight) * 2;
  259. //状态栏加导航栏高度
  260. let navStatusBarHeight = statusBarHeight + menu.height + (menu.top - statusBarHeight) * 2; // 现在是px
  261. let rpxHeight = parseInt((navStatusBarHeight * 750) / systemInfo.windowWidth);
  262. rpxHeight = Math.ceil(rpxHeight / 10) * 10;
  263. that.menuTop = rpxHeight;
  264. // console.log(that.menuTop);
  265. // #endif
  266. // 默认筛选项
  267. if (params.filterStepStatus !== undefined) {
  268. that.filterStepStatus = parseInt(params.filterStepStatus);
  269. this.filterDropdownValue = [[],[],[],[that.filterStepStatus],[]]
  270. }
  271. // 项目筛选
  272. uni.api.estate.apiestatelist({page_size: 100}).then(res => {
  273. let propertyList = res.list || []
  274. if (propertyList.length > 0) {
  275. that.filterData[1]['submenu'] = propertyList.map(function(val, index) {
  276. return { name: val.estate_name, value: val.estate_id };
  277. });
  278. that.filterData[1]['submenu'].unshift({ value: 999, name: '全部' });
  279. }
  280. })
  281. this.getDataList()
  282. this.curRoles = uni.getStorageSync('MD_userInfo2') ? uni.getStorageSync('MD_userInfo2').roles : ''
  283. },
  284. onReachBottom() {
  285. if (that.loadmore.status == 'nomore') return;
  286. that.loadmore.currnetPage++
  287. this.getDataList()
  288. },
  289. onPullDownRefresh() {
  290. // 防止频繁刷新
  291. },
  292. methods: {
  293. getDataList (bc) {
  294. const that = this
  295. let params = {
  296. ...this.searchFormData
  297. }
  298. if (that.filterHours > 0) {
  299. let d = +new Date()
  300. params.start_at = parseInt((d - 1000 * 60 * 60 * that.filterHours) / 1000)
  301. params.end_at = parseInt(d / 1000)
  302. }
  303. if (that.filterVerifyStatus < 999) {
  304. params.report_state = that.filterVerifyStatus
  305. }
  306. if (that.filterStepStatus < 999) {
  307. params.report_step = that.filterStepStatus
  308. }
  309. if (that.filterPropertyId < 999) {
  310. params.estate_id = that.filterPropertyId
  311. }
  312. if (that.orderMethod > 0) {
  313. if (that.orderMethod === 1) {
  314. params.order_by = JSON.stringify([{
  315. field: 'create_at',
  316. sort: 'desc',
  317. }])
  318. }
  319. if (that.orderMethod === 2) {
  320. params.order_by = JSON.stringify([{
  321. field: 'create_at',
  322. sort: 'asc',
  323. }])
  324. }
  325. }
  326. uni.api.estate.apireportlist({
  327. page: that.loadmore.currnetPage,
  328. ...params,
  329. }).then(res => {
  330. const list = res.list || []
  331. if (list.length < 10) {
  332. that.loadmore.status = 'nomore';
  333. }
  334. if (res.current_page === 1) {
  335. if (list.length === 0) {
  336. uni.$msg('无搜索结果', 'none');
  337. }
  338. that.customerList = [...list]
  339. } else {
  340. that.customerList = that.customerList.concat(list)
  341. }
  342. if (bc) bc()
  343. })
  344. },
  345. customBack() {
  346. uni.navigateBack();
  347. },
  348. // 带监听器跳转
  349. pageTo(url, data) {
  350. /// xxxxx
  351. uni.navigateTo({
  352. url: url,
  353. events: {
  354. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  355. update: function(data) {
  356. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  357. }
  358. },
  359. success: function(res) {
  360. // 通过eventChannel向被打开页面传送数据
  361. res.eventChannel.emit('data', data);
  362. }
  363. });
  364. },
  365. searchHandle() {
  366. that.loadmore.currnetPage = 1
  367. this.getDataList(() => {
  368. this.searchPopupShow = false
  369. })
  370. },
  371. // 筛选
  372. confirmFilter(e) {
  373. if (e['value'][0][0] !== null) that.filterHours = e['value'][0][0];
  374. if (e['value'][1][0] !== null) that.filterPropertyId = e['value'][1][0];
  375. if (e['value'][2][0] !== null) that.filterVerifyStatus = e['value'][2][0];
  376. if (e['value'][3][0] !== null) that.filterStepStatus = e['value'][3][0];
  377. if (e['value'][4][0] !== null) that.orderMethod = e['value'][4][0];
  378. that.loadmore.currnetPage = 1;
  379. this.getDataList()
  380. },
  381. getTime(n) {
  382. let date = n ? new Date(n) : new Date()
  383. let year = date.getFullYear()
  384. let month = date.getMonth() + 1
  385. month = month > 9 ? month : '0' + month
  386. let day = date.getDate()
  387. day = day > 9 ? day : '0' + day
  388. let hour = date.getHours()
  389. hour = hour > 9 ? hour : '0' + hour
  390. let min = date.getMinutes()
  391. min = min > 9 ? min : '0' + min
  392. return year + '-' + month + '-' + day
  393. },
  394. }
  395. };
  396. </script>
  397. <style lang="scss">
  398. .search-wrap {
  399. padding: 20rpx;
  400. }
  401. .filter-wrap {
  402. position: relative;
  403. }
  404. // 列表
  405. .customer-list-wrap {
  406. margin-top: 80rpx;
  407. width: 100%;
  408. .customer-item {
  409. display: flex;
  410. flex-direction: column;
  411. align-items: flex-start;
  412. font-size: $u-p2;
  413. color: $u-content-color;
  414. border-bottom: 1rpx solid $u-border-color;
  415. padding: 24rpx 32rpx;
  416. .info {
  417. display: flex;
  418. align-items: flex-start;
  419. justify-content: space-between;
  420. width: 100%;
  421. margin-bottom: 10rpx;
  422. .customer {
  423. display: flex;
  424. flex-direction: column;
  425. align-items: flex-start;
  426. .relname {
  427. color: $u-main-color;
  428. font-size: $u-p;
  429. font-weight: bold;
  430. margin-bottom: 10rpx;
  431. }
  432. .item {
  433. margin-bottom: 10rpx;
  434. }
  435. }
  436. .data-wrap {
  437. text-align: right;
  438. .date {
  439. font-size: $u-sub;
  440. }
  441. }
  442. }
  443. .tool-wrap {
  444. display: flex;
  445. align-items: center;
  446. justify-content: space-between;
  447. width: 100%;
  448. }
  449. }
  450. }
  451. .float-search {
  452. opacity: 0.9;
  453. position: fixed;
  454. right: 20rpx;
  455. bottom: 40rpx;
  456. padding: 20rpx;
  457. border-radius: 50%;
  458. background-color: $u-theme-color;
  459. }
  460. </style>