list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. <template>
  2. <view class="scoped-box">
  3. <wm-watermark :text="userInfo2.phone" :num="50"></wm-watermark>
  4. <u-navbar
  5. :customBack="customBack"
  6. back-icon-color="#fff"
  7. :title="`报备列表(${curTotal})`"
  8. :background="{ backgroundColor: '#2080f0' }"
  9. title-color="#fff"
  10. :border-bottom="false"
  11. ></u-navbar>
  12. <!-- 顶部筛选栏 -->
  13. <HM-filterDropdown :menuTop="menuTop" :filterData="filterData" :defaultSelected="filterDropdownValue" @confirm="confirmFilter"></HM-filterDropdown>
  14. <view class="customer-list-wrap">
  15. <view v-if="customerList.length == 0" class="empty-wrap"><u-empty mode="list" text="暂无相关客户"></u-empty></view>
  16. <view v-for="(item, index) in customerList" class="customer-item" :key="index">
  17. <view class="info" @click="listItemHandle(item)">
  18. <view class="customer">
  19. <view class="relname">
  20. {{ item.name }}
  21. <u-icon
  22. class="u-m-l-5"
  23. :name="item.sex == 'male' ? 'man' : 'woman'"
  24. size="28"
  25. :color="item.sex == 'male' ? '#2080f0' : '#f85f69'"
  26. ></u-icon>
  27. </view>
  28. <view class="item">
  29. <u-icon class="u-m-r-5" name="phone" size="28"></u-icon>
  30. {{ item.phone }}
  31. </view>
  32. <view class="item">
  33. <u-icon class="u-m-r-5" name="home" size="28"></u-icon>
  34. {{ item.estate_name }}
  35. </view>
  36. <view class="item" v-if="item.remark">备注:{{ item.remark}}</view>
  37. </view>
  38. <view class="data-wrap">
  39. <view class="date u-m-t-5">报备:{{item.create_at}}</view>
  40. <view class="date" v-if="item.lock_at">截止:{{item.lock_at}}</view>
  41. </view>
  42. </view>
  43. <view class="tool-wrap">
  44. <view class="tag">
  45. <u-tag
  46. :text="item.report_state == 3 ? '无效客户' : item.report_state == 2 ? '审核中' : '有效客户'"
  47. :type="item.report_state == 3 ? 'error' : item.report_state == 2 ? 'warning' : 'success'"
  48. size="mini"
  49. class="u-m-r-10"
  50. ></u-tag>
  51. <u-tag
  52. v-if="item.report_state == 1"
  53. :text="stepList[item.report_step]"
  54. :type="Number(item.report_step) > 1 ? 'success' : 'warning'"
  55. size="mini"
  56. ></u-tag>
  57. <u-icon
  58. v-if="item.report_state == 3"
  59. name="reload"
  60. size="32"
  61. label="重新报备"
  62. label-size="24"
  63. color="#f00"
  64. label-color="#f00"
  65. @click="pageTo('/pages/agent/recommend/create', { info: item })"
  66. ></u-icon>
  67. </view>
  68. <!-- v-if="curRoles == 1 || curRoles == 3 || curRoles == 5 || curRoles == 6" -->
  69. <view class="scoped-list-more-info">
  70. <text @click="dial(item.create_user.phone)">报备人:{{item.create_user.nickname}}</text>
  71. <u-tag
  72. @click="copyTextHandle(item)"
  73. style="margin-left: 10px;"
  74. text="复制"
  75. type="primary"
  76. size="mini"
  77. ></u-tag>
  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. import wmWatermark from '@/components/wm-watermark/wm-watermark.vue'
  111. import uniCopy from '@/js_sdk/xb-copy/uni-copy.js'
  112. var that;
  113. export default {
  114. components: {
  115. wmWatermark
  116. },
  117. data() {
  118. return {
  119. searchKeyword: null,
  120. searchPopupShow: false,
  121. searchFormData: {
  122. name: '',
  123. phone: ''
  124. }, // 搜索栏数据
  125. menuTop: 110, // 筛选栏距顶部距离
  126. filterData: [
  127. {
  128. name: '日期范围',
  129. type: 'hierarchy',
  130. submenu: [
  131. {
  132. name: '全部',
  133. value: 0
  134. },
  135. {
  136. name: '24小时内',
  137. value: 24
  138. },
  139. {
  140. name: '3天内',
  141. value: 72
  142. },
  143. {
  144. name: '7天内',
  145. value: 168
  146. },
  147. {
  148. name: '半个月内',
  149. value: 360
  150. },
  151. {
  152. name: '一个月内',
  153. value: 720
  154. }
  155. ]
  156. },
  157. {
  158. name: '意向项目',
  159. type: 'hierarchy',
  160. submenu: [
  161. {
  162. name: '全部',
  163. value: 999
  164. }
  165. ]
  166. },
  167. {
  168. name: '客户状态',
  169. type: 'hierarchy',
  170. submenu: [
  171. {
  172. name: '全部状态',
  173. value: 999
  174. },
  175. {
  176. name: '有效(暂无)',
  177. value: 1
  178. },
  179. {
  180. name: '审核中(暂无)',
  181. value: 2
  182. },
  183. {
  184. name: '无效(暂无)',
  185. value: 3
  186. }
  187. ]
  188. },
  189. {
  190. name: '客户进度',
  191. type: 'hierarchy',
  192. submenu: [
  193. {
  194. name: '全部进度',
  195. value: 999
  196. },
  197. {
  198. name: '未到访(暂无)',
  199. value: 1
  200. },
  201. {
  202. name: '已到访(暂无)',
  203. value: 2
  204. },
  205. {
  206. name: '已认购(暂无)',
  207. value: 3
  208. },
  209. {
  210. name: '已签约(暂无)',
  211. value: 4
  212. },
  213. {
  214. name: '已结佣(暂无)',
  215. value: 5
  216. }
  217. ]
  218. },
  219. {
  220. name: '排序',
  221. type: 'hierarchy',
  222. submenu: [
  223. {
  224. name: '时间近到远',
  225. value: 1
  226. },
  227. {
  228. name: '时间远到近',
  229. value: 2
  230. },
  231. // {
  232. // name: '预期佣金高到底',
  233. // value: 2
  234. // },
  235. // {
  236. // name: '预期佣金低到高',
  237. // value: 3
  238. // }
  239. ]
  240. }
  241. ],
  242. filterHours: 0,
  243. filterPropertyId: 999,
  244. filterVerifyStatus: 999,
  245. filterStepStatus: 999,
  246. orderMethod: 0,
  247. filterDropdownValue: {}, // 默认筛选
  248. customerList: [], // 客户列表
  249. stepList: ['审核中', '未到访', '已到访', '已认购', '已签约', '已结佣'],
  250. loadmore: {
  251. status: 'loadmore',
  252. loadingText: '努力加载中',
  253. defaultText: '轻轻上拉 查看更多',
  254. nomoreText: '实在没有了',
  255. currnetPage: 1
  256. },
  257. curRoles: '',
  258. userInfo2: {},
  259. curTotal: 0,
  260. };
  261. },
  262. onLoad(params) {
  263. that = this;
  264. // #ifdef H5
  265. that.menuTop = 88;
  266. // #endif
  267. // #ifdef MP
  268. let systemInfo = wx.getSystemInfoSync();
  269. //状态栏高度
  270. let statusBarHeight = Number(systemInfo.statusBarHeight);
  271. let menu = wx.getMenuButtonBoundingClientRect();
  272. //导航栏高度
  273. let navBarHeight = menu.height + (menu.top - statusBarHeight) * 2;
  274. //状态栏加导航栏高度
  275. let navStatusBarHeight = statusBarHeight + menu.height + (menu.top - statusBarHeight) * 2; // 现在是px
  276. let rpxHeight = parseInt((navStatusBarHeight * 750) / systemInfo.windowWidth);
  277. rpxHeight = Math.ceil(rpxHeight / 10) * 10;
  278. that.menuTop = rpxHeight;
  279. // console.log(that.menuTop);
  280. // #endif
  281. // 默认筛选项
  282. if (params.filterStepStatus !== undefined) {
  283. that.filterStepStatus = parseInt(params.filterStepStatus);
  284. this.filterDropdownValue = [[],[],[],[that.filterStepStatus],[]]
  285. }
  286. // 项目筛选
  287. uni.api.estate.apiestatelist({page_size: 100}).then(res => {
  288. let propertyList = res.list || []
  289. if (propertyList.length > 0) {
  290. that.filterData[1]['submenu'] = propertyList.map(function(val, index) {
  291. return { name: val.estate_name, value: val.estate_id };
  292. });
  293. that.filterData[1]['submenu'].unshift({ value: 999, name: '全部' });
  294. }
  295. })
  296. uni.api.estate.apireportgroupcount({page_size: 100}).then(res => {
  297. let report_state_count = res.report_state_count || []
  298. let report_step_count = res.report_step_count || []
  299. let filterData = [...this.filterData]
  300. report_state_count.forEach((rsc, i) => {
  301. if (rsc.report_state == 1) {
  302. filterData[2].submenu[1].name = `有效(${report_state_count[i].total})`
  303. }
  304. if (rsc.report_state == 2) {
  305. filterData[2].submenu[2].name = `审核中(${report_state_count[i].total})`
  306. }
  307. if (rsc.report_state == 3) {
  308. filterData[2].submenu[3].name = `无效(${report_state_count[i].total})`
  309. }
  310. })
  311. report_step_count.forEach((rsc, i) => {
  312. if (rsc.report_step == 1) {
  313. filterData[3].submenu[1].name = `未到访(${report_step_count[i].total})`
  314. }
  315. if (rsc.report_step == 2) {
  316. filterData[3].submenu[2].name = `已到访(${report_step_count[i].total})`
  317. }
  318. if (rsc.report_step == 3) {
  319. filterData[3].submenu[3].name = `已认购(${report_step_count[i].total})`
  320. }
  321. if (rsc.report_step == 4) {
  322. filterData[3].submenu[4].name = `已签约(${report_step_count[i].total})`
  323. }
  324. if (rsc.report_step == 5) {
  325. filterData[3].submenu[5].name = `已结佣(${report_step_count[i].total})`
  326. }
  327. })
  328. this.filterData = [...filterData]
  329. })
  330. this.getDataList()
  331. this.userInfo2 = uni.getStorageSync('MD_userInfo2')
  332. this.curRoles = uni.getStorageSync('MD_userInfo2') ? uni.getStorageSync('MD_userInfo2').roles : ''
  333. },
  334. onReachBottom() {
  335. if (that.loadmore.status == 'nomore') return;
  336. that.loadmore.currnetPage++
  337. this.getDataList()
  338. },
  339. onPullDownRefresh() {
  340. // 防止频繁刷新
  341. },
  342. methods: {
  343. dial(tel) {
  344. uni.makePhoneCall({
  345. phoneNumber: tel
  346. });
  347. },
  348. listItemHandle (item) {
  349. if (item.report_state == 2) {
  350. if (this.curRoles == 1 || this.curRoles == 5 || this.curRoles == 7 || this.curRoles == 10) {
  351. uni.$msgConfirm('当前客户报备审核中,是否前往审核?', () => {
  352. uni.navigateTo({
  353. url: `/pages/agent/recommend/check?id=${item.id}&name=${item.name}&phone=${item.phone}&eid=${item.estate_id}`
  354. })
  355. })
  356. } else {
  357. uni.$msgConfirm('当前客户报备审核中~')
  358. }
  359. } else {
  360. uni.navigateTo({
  361. url: '/pages/agent/recommend/detail?id=' + item.id
  362. })
  363. }
  364. },
  365. copyTextHandle (item) {
  366. // return
  367. uniCopy({
  368. content: `项目:${item.estate_name}
  369. 客户姓名:${item.name}${item.sex == 'male'?'先生':'女士'}
  370. 客户电话:${item.phone}
  371. 经纪人姓名:${item.create_user.nickname}
  372. 经纪人电话:${item.create_user.phone}
  373. 预计到访时间:尽快`,
  374. success:(res)=>{
  375. uni.showToast({
  376. title: res,
  377. icon: 'none'
  378. })
  379. },
  380. error:(e)=>{
  381. uni.showToast({
  382. title: e,
  383. icon: 'none',
  384. duration:3000,
  385. })
  386. }
  387. })
  388. },
  389. getDataList (bc) {
  390. const that = this
  391. let params = {
  392. ...this.searchFormData
  393. }
  394. if (that.filterHours > 0) {
  395. let d = +new Date()
  396. params.start_at = parseInt((d - 1000 * 60 * 60 * that.filterHours) / 1000)
  397. params.end_at = parseInt(d / 1000)
  398. }
  399. if (that.filterVerifyStatus < 999) {
  400. params.report_state = that.filterVerifyStatus
  401. }
  402. if (that.filterStepStatus < 999) {
  403. params.report_step = that.filterStepStatus
  404. }
  405. if (that.filterPropertyId < 999) {
  406. params.estate_id = that.filterPropertyId
  407. }
  408. if (that.orderMethod > 0) {
  409. if (that.orderMethod === 1) {
  410. params.order_by = JSON.stringify([{
  411. field: 'create_at',
  412. sort: 'desc',
  413. }])
  414. }
  415. if (that.orderMethod === 2) {
  416. params.order_by = JSON.stringify([{
  417. field: 'create_at',
  418. sort: 'asc',
  419. }])
  420. }
  421. }
  422. uni.api.estate.apireportlist({
  423. page: that.loadmore.currnetPage,
  424. ...params,
  425. }).then(res => {
  426. this.curTotal = res.total || 0
  427. const list = res.list || []
  428. if (list.length < 10) {
  429. that.loadmore.status = 'nomore';
  430. }
  431. if (res.current_page === 1) {
  432. if (list.length === 0) {
  433. uni.$msg('无搜索结果', 'none');
  434. }
  435. that.customerList = [...list]
  436. } else {
  437. that.customerList = that.customerList.concat(list)
  438. }
  439. if (bc) bc()
  440. })
  441. },
  442. customBack() {
  443. // uni.navigateBack();
  444. uni.reLaunch({
  445. url: '/pages/index/index'
  446. })
  447. },
  448. // 带监听器跳转
  449. pageTo(url, data) {
  450. /// xxxxx
  451. uni.navigateTo({
  452. url: url,
  453. events: {
  454. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  455. update: function(data) {
  456. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  457. }
  458. },
  459. success: function(res) {
  460. // 通过eventChannel向被打开页面传送数据
  461. res.eventChannel.emit('data', data);
  462. }
  463. });
  464. },
  465. searchHandle() {
  466. this.loadmore.currnetPage = 1
  467. this.getDataList(() => {
  468. this.searchPopupShow = false
  469. })
  470. },
  471. // 筛选
  472. confirmFilter(e) {
  473. if (e['value'][0][0] !== null) that.filterHours = e['value'][0][0];
  474. if (e['value'][1][0] !== null) that.filterPropertyId = e['value'][1][0];
  475. if (e['value'][2][0] !== null) that.filterVerifyStatus = e['value'][2][0];
  476. if (e['value'][3][0] !== null) that.filterStepStatus = e['value'][3][0];
  477. if (e['value'][4][0] !== null) that.orderMethod = e['value'][4][0];
  478. that.loadmore.currnetPage = 1;
  479. this.getDataList()
  480. },
  481. getTime(n) {
  482. let date = n ? new Date(n) : new Date()
  483. let year = date.getFullYear()
  484. let month = date.getMonth() + 1
  485. month = month > 9 ? month : '0' + month
  486. let day = date.getDate()
  487. day = day > 9 ? day : '0' + day
  488. let hour = date.getHours()
  489. hour = hour > 9 ? hour : '0' + hour
  490. let minute = date.getMinutes()
  491. minute = minute > 9 ? minute : '0' + minute
  492. let second = date.getSeconds()
  493. second = second > 9 ? second : '0' + second
  494. return `${year}-${month}-${day} ${hour}:${minute}:${second}`
  495. },
  496. }
  497. };
  498. </script>
  499. <style lang="scss">
  500. .scoped-box {
  501. font-size: 30rpx;
  502. }
  503. .search-wrap {
  504. padding: 20rpx;
  505. }
  506. .filter-wrap {
  507. position: relative;
  508. }
  509. // 列表
  510. .customer-list-wrap {
  511. margin-top: 80rpx;
  512. width: 100%;
  513. .customer-item {
  514. display: flex;
  515. flex-direction: column;
  516. align-items: flex-start;
  517. font-size: $u-p;
  518. color: $u-content-color;
  519. border-bottom: 1rpx solid $u-border-color;
  520. padding: 24rpx 32rpx;
  521. .info {
  522. display: flex;
  523. align-items: flex-start;
  524. justify-content: space-between;
  525. width: 100%;
  526. margin-bottom: 10rpx;
  527. .customer {
  528. display: flex;
  529. flex-direction: column;
  530. align-items: flex-start;
  531. .relname {
  532. color: $u-main-color;
  533. font-size: 34rpx;
  534. font-weight: bold;
  535. margin-bottom: 10rpx;
  536. }
  537. .item {
  538. margin-bottom: 10rpx;
  539. }
  540. }
  541. .data-wrap {
  542. text-align: right;
  543. .date {
  544. font-size: $u-sub;
  545. }
  546. }
  547. }
  548. .tool-wrap {
  549. display: flex;
  550. align-items: center;
  551. justify-content: space-between;
  552. width: 100%;
  553. }
  554. }
  555. }
  556. .float-search {
  557. opacity: 0.9;
  558. position: fixed;
  559. right: 20rpx;
  560. bottom: 40rpx;
  561. padding: 20rpx;
  562. border-radius: 50%;
  563. background-color: $u-theme-color;
  564. }
  565. .scoped-list-more-info {
  566. position: absolute;
  567. right: 20rpx;
  568. font-size: 24rpx;
  569. }
  570. </style>