estate.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  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. </view>
  58. <!-- v-if="curRoles == 1 || curRoles == 3 || curRoles == 5 || curRoles == 6" -->
  59. <view class="scoped-list-more-info">
  60. <text @click="dial(item.create_user.phone)">报备人:{{item.create_user.nickname}}</text>
  61. <u-tag
  62. @click="copyTextHandle(item)"
  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. 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: '7天内',
  141. value: 168
  142. },
  143. {
  144. name: '30天内',
  145. value: 720
  146. }
  147. ]
  148. },
  149. {
  150. name: '管理楼盘',
  151. type: 'hierarchy',
  152. submenu: [
  153. {
  154. name: '全部',
  155. value: 999
  156. }
  157. ]
  158. },
  159. {
  160. name: '客户状态',
  161. type: 'hierarchy',
  162. submenu: [
  163. {
  164. name: '全部状态',
  165. value: 999
  166. },
  167. {
  168. name: '有效',
  169. value: 1
  170. },
  171. {
  172. name: '审核中',
  173. value: 2
  174. },
  175. {
  176. name: '无效',
  177. value: 3
  178. }
  179. ]
  180. },
  181. {
  182. name: '客户进度',
  183. type: 'hierarchy',
  184. submenu: [
  185. {
  186. name: '全部进度',
  187. value: 999
  188. },
  189. {
  190. name: '未到访',
  191. value: 1
  192. },
  193. {
  194. name: '已到访',
  195. value: 2
  196. },
  197. {
  198. name: '已认购',
  199. value: 3
  200. },
  201. {
  202. name: '已签约',
  203. value: 4
  204. },
  205. {
  206. name: '已结佣',
  207. value: 5
  208. }
  209. ]
  210. },
  211. {
  212. name: '排序',
  213. type: 'hierarchy',
  214. submenu: [
  215. {
  216. name: '时间近到远',
  217. value: 1
  218. },
  219. {
  220. name: '时间远到近',
  221. value: 2
  222. },
  223. // {
  224. // name: '预期佣金高到底',
  225. // value: 2
  226. // },
  227. // {
  228. // name: '预期佣金低到高',
  229. // value: 3
  230. // }
  231. ]
  232. }
  233. ],
  234. filterHours: 0,
  235. filterPropertyId: 999,
  236. filterVerifyStatus: 999,
  237. filterStepStatus: 999,
  238. orderMethod: 0,
  239. filterDropdownValue: {}, // 默认筛选
  240. customerList: [], // 客户列表
  241. stepList: ['审核中', '未到访', '已到访', '已认购', '已签约', '已结佣'],
  242. loadmore: {
  243. status: 'loadmore',
  244. loadingText: '努力加载中',
  245. defaultText: '轻轻上拉 查看更多',
  246. nomoreText: '实在没有了',
  247. currnetPage: 1
  248. },
  249. curRoles: '',
  250. userInfo2: {},
  251. curTotal: 0,
  252. };
  253. },
  254. onLoad(params) {
  255. that = this;
  256. // #ifdef H5
  257. that.menuTop = 88;
  258. // #endif
  259. // #ifdef MP
  260. let systemInfo = wx.getSystemInfoSync();
  261. //状态栏高度
  262. let statusBarHeight = Number(systemInfo.statusBarHeight);
  263. let menu = wx.getMenuButtonBoundingClientRect();
  264. //导航栏高度
  265. let navBarHeight = menu.height + (menu.top - statusBarHeight) * 2;
  266. //状态栏加导航栏高度
  267. let navStatusBarHeight = statusBarHeight + menu.height + (menu.top - statusBarHeight) * 2; // 现在是px
  268. let rpxHeight = parseInt((navStatusBarHeight * 750) / systemInfo.windowWidth);
  269. rpxHeight = Math.ceil(rpxHeight / 10) * 10;
  270. that.menuTop = rpxHeight;
  271. // console.log(that.menuTop);
  272. // #endif
  273. // 默认筛选项
  274. if (params.filterStepStatus !== undefined) {
  275. that.filterStepStatus = parseInt(params.filterStepStatus);
  276. this.filterDropdownValue = [[],[],[],[that.filterStepStatus],[]]
  277. }
  278. // 项目筛选
  279. // uni.api.estate.apiestatelist({page_size: 100}).then(res => {
  280. // let propertyList = res.list || []
  281. // if (propertyList.length > 0) {
  282. // that.filterData[1]['submenu'] = propertyList.map(function(val, index) {
  283. // return { name: val.estate_name, value: val.estate_id };
  284. // });
  285. // that.filterData[1]['submenu'].unshift({ value: 999, name: '全部' });
  286. // }
  287. // })
  288. this.getDataList()
  289. this.userInfo2 = uni.getStorageSync('MD_userInfo2')
  290. this.curRoles = uni.getStorageSync('MD_userInfo2') ? uni.getStorageSync('MD_userInfo2').roles : ''
  291. let propertyList = this.userInfo2.estate_govern || []
  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. onReachBottom() {
  300. if (that.loadmore.status == 'nomore') return;
  301. that.loadmore.currnetPage++
  302. this.getDataList()
  303. },
  304. onPullDownRefresh() {
  305. // 防止频繁刷新
  306. },
  307. methods: {
  308. dial(tel) {
  309. uni.makePhoneCall({
  310. phoneNumber: tel
  311. });
  312. },
  313. listItemHandle (item) {
  314. if (item.report_state == 2) {
  315. // if (this.curRoles == 1 || this.curRoles == 5 || this.curRoles == 7) {
  316. // uni.$msgConfirm('当前客户报备审核中,是否前往审核?', () => {
  317. // uni.navigateTo({
  318. // url: `/pages/agent/recommend/check?id=${item.id}&name=${item.name}-${item.phone}`
  319. // })
  320. // })
  321. // } else {
  322. // uni.$msgConfirm('当前客户报备审核中~')
  323. // }
  324. uni.$msgConfirm('当前客户报备审核中,是否前往审核?', () => {
  325. uni.navigateTo({
  326. url: `/pages/agent/recommend/check?id=${item.id}&name=${item.name}&phone=${item.phone}&eid=${item.estate_id}`
  327. })
  328. })
  329. } else {
  330. uni.navigateTo({
  331. url: '/pages/agent/recommend/detailGovern?id=' + item.id
  332. })
  333. }
  334. },
  335. copyTextHandle (item) {
  336. // return
  337. uniCopy({
  338. content: `项目:${item.estate_name}
  339. 客户姓名:${item.name}${item.sex == 'male'?'先生':'女士'}
  340. 客户电话:${item.phone}
  341. 经纪人姓名:${item.create_user.nickname}
  342. 经纪人电话:${item.create_user.phone}
  343. 预计到访时间:尽快`,
  344. success:(res)=>{
  345. uni.showToast({
  346. title: res,
  347. icon: 'none'
  348. })
  349. },
  350. error:(e)=>{
  351. uni.showToast({
  352. title: e,
  353. icon: 'none',
  354. duration:3000,
  355. })
  356. }
  357. })
  358. },
  359. getDataList (bc) {
  360. const that = this
  361. let params = {
  362. ...this.searchFormData
  363. }
  364. if (that.filterHours > 0) {
  365. let d = +new Date()
  366. params.start_at = parseInt((d - 1000 * 60 * 60 * that.filterHours) / 1000)
  367. params.end_at = parseInt(d / 1000)
  368. }
  369. if (that.filterVerifyStatus < 999) {
  370. params.report_state = that.filterVerifyStatus
  371. }
  372. if (that.filterStepStatus < 999) {
  373. params.report_step = that.filterStepStatus
  374. }
  375. if (that.filterPropertyId < 999) {
  376. params.estate_id = that.filterPropertyId
  377. }
  378. if (that.orderMethod > 0) {
  379. if (that.orderMethod === 1) {
  380. params.order_by = JSON.stringify([{
  381. field: 'create_at',
  382. sort: 'desc',
  383. }])
  384. }
  385. if (that.orderMethod === 2) {
  386. params.order_by = JSON.stringify([{
  387. field: 'create_at',
  388. sort: 'asc',
  389. }])
  390. }
  391. }
  392. uni.api.estate.apigovernlist({
  393. page: that.loadmore.currnetPage,
  394. ...params,
  395. }).then(res => {
  396. this.curTotal = res.total || 0
  397. const list = res.list || []
  398. if (list.length < 10) {
  399. that.loadmore.status = 'nomore';
  400. }
  401. if (res.current_page === 1) {
  402. if (list.length === 0) {
  403. uni.$msg('无搜索结果', 'none');
  404. }
  405. that.customerList = [...list]
  406. } else {
  407. that.customerList = that.customerList.concat(list)
  408. }
  409. if (bc) bc()
  410. })
  411. },
  412. customBack() {
  413. // uni.navigateBack();
  414. uni.reLaunch({
  415. url: '/pages/index/index'
  416. })
  417. },
  418. // 带监听器跳转
  419. pageTo(url, data) {
  420. /// xxxxx
  421. uni.navigateTo({
  422. url: url,
  423. events: {
  424. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  425. update: function(data) {
  426. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  427. }
  428. },
  429. success: function(res) {
  430. // 通过eventChannel向被打开页面传送数据
  431. res.eventChannel.emit('data', data);
  432. }
  433. });
  434. },
  435. searchHandle() {
  436. this.loadmore.currnetPage = 1
  437. this.getDataList(() => {
  438. this.searchPopupShow = false
  439. })
  440. },
  441. // 筛选
  442. confirmFilter(e) {
  443. if (e['value'][0][0] !== null) that.filterHours = e['value'][0][0];
  444. if (e['value'][1][0] !== null) that.filterPropertyId = e['value'][1][0];
  445. if (e['value'][2][0] !== null) that.filterVerifyStatus = e['value'][2][0];
  446. if (e['value'][3][0] !== null) that.filterStepStatus = e['value'][3][0];
  447. if (e['value'][4][0] !== null) that.orderMethod = e['value'][4][0];
  448. that.loadmore.currnetPage = 1;
  449. this.getDataList()
  450. },
  451. getTime(n) {
  452. let date = n ? new Date(n) : new Date()
  453. let year = date.getFullYear()
  454. let month = date.getMonth() + 1
  455. month = month > 9 ? month : '0' + month
  456. let day = date.getDate()
  457. day = day > 9 ? day : '0' + day
  458. let hour = date.getHours()
  459. hour = hour > 9 ? hour : '0' + hour
  460. let minute = date.getMinutes()
  461. minute = minute > 9 ? minute : '0' + minute
  462. let second = date.getSeconds()
  463. second = second > 9 ? second : '0' + second
  464. return `${year}-${month}-${day} ${hour}:${minute}:${second}`
  465. },
  466. }
  467. };
  468. </script>
  469. <style lang="scss">
  470. .scoped-box {
  471. font-size: 30rpx;
  472. }
  473. .search-wrap {
  474. padding: 20rpx;
  475. }
  476. .filter-wrap {
  477. position: relative;
  478. }
  479. // 列表
  480. .customer-list-wrap {
  481. margin-top: 80rpx;
  482. width: 100%;
  483. .customer-item {
  484. display: flex;
  485. flex-direction: column;
  486. align-items: flex-start;
  487. font-size: $u-p;
  488. color: $u-content-color;
  489. border-bottom: 1rpx solid $u-border-color;
  490. padding: 24rpx 32rpx;
  491. .info {
  492. display: flex;
  493. align-items: flex-start;
  494. justify-content: space-between;
  495. width: 100%;
  496. margin-bottom: 10rpx;
  497. .customer {
  498. display: flex;
  499. flex-direction: column;
  500. align-items: flex-start;
  501. .relname {
  502. color: $u-main-color;
  503. font-size: 34rpx;
  504. font-weight: bold;
  505. margin-bottom: 10rpx;
  506. }
  507. .item {
  508. margin-bottom: 10rpx;
  509. }
  510. }
  511. .data-wrap {
  512. text-align: right;
  513. .date {
  514. font-size: $u-sub;
  515. }
  516. }
  517. }
  518. .tool-wrap {
  519. display: flex;
  520. align-items: center;
  521. justify-content: space-between;
  522. width: 100%;
  523. }
  524. }
  525. }
  526. .float-search {
  527. opacity: 0.9;
  528. position: fixed;
  529. right: 20rpx;
  530. bottom: 40rpx;
  531. padding: 20rpx;
  532. border-radius: 50%;
  533. background-color: $u-theme-color;
  534. }
  535. .scoped-list-more-info {
  536. position: absolute;
  537. right: 20rpx;
  538. font-size: 24rpx;
  539. }
  540. </style>