list.vue 15 KB

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