list.vue 14 KB

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