list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  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. if(item.estate_name.indexOf('江投青云春天') > -1) {
  367. uniCopy({
  368. content: `项目名称:${item.estate_name}
  369. 客户姓名:${item.name}
  370. 客户性别:${item.sex == 'male'?'先生':'女士'}
  371. 客户电话:${item.phone}
  372. 报备时间:${item.create_at}
  373. 预计到访时间:${item.create_at}
  374. 渠道:洪楼
  375. 报备人:${item.create_user.nickname}
  376. 报备人电话:${item.create_user.phone}
  377. 实际带看人:${item.create_user.nickname}
  378. 实际带看人电话:${item.create_user.phone}`,
  379. success:(res)=>{
  380. uni.showToast({
  381. title: res,
  382. icon: 'none'
  383. })
  384. },
  385. error:(e)=>{
  386. uni.showToast({
  387. title: e,
  388. icon: 'none',
  389. duration:3000,
  390. })
  391. }
  392. })
  393. } else {
  394. uniCopy({
  395. content: `项目:${item.estate_name}
  396. 客户姓名:${item.name}${item.sex == 'male'?'先生':'女士'}
  397. 客户电话:${item.phone}
  398. 经纪人姓名:${item.create_user.nickname}
  399. 经纪人电话:${item.create_user.phone}
  400. 预计到访时间:尽快`,
  401. success:(res)=>{
  402. uni.showToast({
  403. title: res,
  404. icon: 'none'
  405. })
  406. },
  407. error:(e)=>{
  408. uni.showToast({
  409. title: e,
  410. icon: 'none',
  411. duration:3000,
  412. })
  413. }
  414. })
  415. }
  416. },
  417. getDataList (bc) {
  418. const that = this
  419. let params = {
  420. ...this.searchFormData
  421. }
  422. if (that.filterHours > 0) {
  423. let d = +new Date()
  424. params.start_at = parseInt((d - 1000 * 60 * 60 * that.filterHours) / 1000)
  425. params.end_at = parseInt(d / 1000)
  426. }
  427. if (that.filterVerifyStatus < 999) {
  428. params.report_state = that.filterVerifyStatus
  429. }
  430. if (that.filterStepStatus < 999) {
  431. params.report_step = that.filterStepStatus
  432. }
  433. if (that.filterPropertyId < 999) {
  434. params.estate_id = that.filterPropertyId
  435. }
  436. if (that.orderMethod > 0) {
  437. if (that.orderMethod === 1) {
  438. params.order_by = JSON.stringify([{
  439. field: 'create_at',
  440. sort: 'desc',
  441. }])
  442. }
  443. if (that.orderMethod === 2) {
  444. params.order_by = JSON.stringify([{
  445. field: 'create_at',
  446. sort: 'asc',
  447. }])
  448. }
  449. }
  450. uni.api.estate.apireportlist({
  451. page: that.loadmore.currnetPage,
  452. ...params,
  453. }).then(res => {
  454. this.curTotal = res.total || 0
  455. const list = res.list || []
  456. if (list.length < 10) {
  457. that.loadmore.status = 'nomore';
  458. }
  459. if (res.current_page === 1) {
  460. if (list.length === 0) {
  461. uni.$msg('无搜索结果', 'none');
  462. }
  463. that.customerList = [...list]
  464. } else {
  465. that.customerList = that.customerList.concat(list)
  466. }
  467. if (bc) bc()
  468. })
  469. },
  470. customBack() {
  471. // uni.navigateBack();
  472. uni.reLaunch({
  473. url: '/pages/index/index'
  474. })
  475. },
  476. // 带监听器跳转
  477. pageTo(url, data) {
  478. /// xxxxx
  479. uni.navigateTo({
  480. url: url,
  481. events: {
  482. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  483. update: function(data) {
  484. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  485. }
  486. },
  487. success: function(res) {
  488. // 通过eventChannel向被打开页面传送数据
  489. res.eventChannel.emit('data', data);
  490. }
  491. });
  492. },
  493. searchHandle() {
  494. this.loadmore.currnetPage = 1
  495. this.getDataList(() => {
  496. this.searchPopupShow = false
  497. })
  498. },
  499. // 筛选
  500. confirmFilter(e) {
  501. if (e['value'][0][0] !== null) that.filterHours = e['value'][0][0];
  502. if (e['value'][1][0] !== null) that.filterPropertyId = e['value'][1][0];
  503. if (e['value'][2][0] !== null) that.filterVerifyStatus = e['value'][2][0];
  504. if (e['value'][3][0] !== null) that.filterStepStatus = e['value'][3][0];
  505. if (e['value'][4][0] !== null) that.orderMethod = e['value'][4][0];
  506. that.loadmore.currnetPage = 1;
  507. this.getDataList()
  508. },
  509. getTime(n) {
  510. let date = n ? new Date(n) : new Date()
  511. let year = date.getFullYear()
  512. let month = date.getMonth() + 1
  513. month = month > 9 ? month : '0' + month
  514. let day = date.getDate()
  515. day = day > 9 ? day : '0' + day
  516. let hour = date.getHours()
  517. hour = hour > 9 ? hour : '0' + hour
  518. let minute = date.getMinutes()
  519. minute = minute > 9 ? minute : '0' + minute
  520. let second = date.getSeconds()
  521. second = second > 9 ? second : '0' + second
  522. return `${year}-${month}-${day} ${hour}:${minute}:${second}`
  523. },
  524. }
  525. };
  526. </script>
  527. <style lang="scss">
  528. .scoped-box {
  529. font-size: 30rpx;
  530. }
  531. .search-wrap {
  532. padding: 20rpx;
  533. }
  534. .filter-wrap {
  535. position: relative;
  536. }
  537. // 列表
  538. .customer-list-wrap {
  539. margin-top: 80rpx;
  540. width: 100%;
  541. .customer-item {
  542. display: flex;
  543. flex-direction: column;
  544. align-items: flex-start;
  545. font-size: $u-p;
  546. color: $u-content-color;
  547. border-bottom: 1rpx solid $u-border-color;
  548. padding: 24rpx 32rpx;
  549. .info {
  550. display: flex;
  551. align-items: flex-start;
  552. justify-content: space-between;
  553. width: 100%;
  554. margin-bottom: 10rpx;
  555. .customer {
  556. display: flex;
  557. flex-direction: column;
  558. align-items: flex-start;
  559. .relname {
  560. color: $u-main-color;
  561. font-size: 34rpx;
  562. font-weight: bold;
  563. margin-bottom: 10rpx;
  564. }
  565. .item {
  566. margin-bottom: 10rpx;
  567. }
  568. }
  569. .data-wrap {
  570. text-align: right;
  571. .date {
  572. font-size: $u-sub;
  573. }
  574. }
  575. }
  576. .tool-wrap {
  577. display: flex;
  578. align-items: center;
  579. justify-content: space-between;
  580. width: 100%;
  581. }
  582. }
  583. }
  584. .float-search {
  585. opacity: 0.9;
  586. position: fixed;
  587. right: 20rpx;
  588. bottom: 40rpx;
  589. padding: 20rpx;
  590. border-radius: 50%;
  591. background-color: $u-theme-color;
  592. }
  593. .scoped-list-more-info {
  594. position: absolute;
  595. right: 20rpx;
  596. font-size: 24rpx;
  597. }
  598. </style>