list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <template>
  2. <view>
  3. <wm-watermark :text="userInfo2.phone" :num="50"></wm-watermark>
  4. <u-navbar
  5. :customBack="customBack"
  6. back-icon-color="#fff"
  7. title="报备列表"
  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="pageTo('/pages/agent/recommend/detail?id=' + item.id)">
  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="22"
  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="22"></u-icon>
  30. {{ item.phone }}
  31. </view>
  32. <view class="item">
  33. <u-icon class="u-m-r-5" name="home" size="22"></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">保护期截止:{{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. <view class="scoped-list-more-info" @click="copyTextHandle(item)" v-if="curRoles == 1 || curRoles == 3 || curRoles == 5 || curRoles == 6">
  62. 报备人:{{item.create_user.nickname}}
  63. <u-tag
  64. style="margin-left: 10px;"
  65. text="复制"
  66. type="primary"
  67. size="mini"
  68. ></u-tag>
  69. </view>
  70. <view class="tool">
  71. <u-icon
  72. v-if="item.report_step <= 1 && item.expire_time == 0"
  73. name="reload"
  74. size="32"
  75. label="重新报备"
  76. label-size="24"
  77. @click="pageTo('/pages/agent/recommend/create', { info: item })"
  78. ></u-icon>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="float-search" @click="searchPopupShow = true"><u-icon name="search" size="42" color="#fff"></u-icon></view>
  84. <!-- 平台佣金政策弹窗 -->
  85. <u-popup v-model="searchPopupShow" mode="center" width="80%" height="440rpx" border-radius="20">
  86. <view class="bwin-popup">
  87. <view class="popup-header">客户搜索</view>
  88. <view class="popup-body">
  89. <u-input v-model="searchFormData.name" border placeholder="请输入客户姓名(支持模糊搜索)"></u-input>
  90. <u-divider marginTop="10" marginBottom="10">或</u-divider>
  91. <u-input v-model="searchFormData.phone" border placeholder="请输入客户手机号(可仅输入一部分)"></u-input>
  92. </view>
  93. <view class="popup-footer" style="position: absolute;">
  94. <u-button size="medium" @click="searchPopupShow = false">取消</u-button>
  95. <u-button size="medium" type="primary" @click="searchHandle()">搜索</u-button>
  96. </view>
  97. </view>
  98. </u-popup>
  99. <u-loadmore
  100. v-if="customerList.length > 0"
  101. marginTop="32"
  102. :line="true"
  103. :status="loadmore.status"
  104. :loading-text="loadmore.loadingText"
  105. :loadmore-text="loadmore.defaultText"
  106. :nomore-text="loadmore.nomoreText"
  107. />
  108. </view>
  109. </template>
  110. <script>
  111. import wmWatermark from '@/components/wm-watermark/wm-watermark.vue'
  112. import uniCopy from '@/js_sdk/xb-copy/uni-copy.js'
  113. var that;
  114. export default {
  115. components: {
  116. wmWatermark
  117. },
  118. data() {
  119. return {
  120. searchKeyword: null,
  121. searchPopupShow: false,
  122. searchFormData: {
  123. name: '',
  124. phone: ''
  125. }, // 搜索栏数据
  126. menuTop: 110, // 筛选栏距顶部距离
  127. filterData: [
  128. {
  129. name: '日期范围',
  130. type: 'hierarchy',
  131. submenu: [
  132. {
  133. name: '全部',
  134. value: 0
  135. },
  136. {
  137. name: '24小时内',
  138. value: 24
  139. },
  140. {
  141. name: '7天内',
  142. value: 168
  143. },
  144. {
  145. name: '30天内',
  146. value: 720
  147. }
  148. ]
  149. },
  150. {
  151. name: '意向项目',
  152. type: 'hierarchy',
  153. submenu: [
  154. {
  155. name: '全部',
  156. value: 999
  157. }
  158. ]
  159. },
  160. {
  161. name: '客户状态',
  162. type: 'hierarchy',
  163. submenu: [
  164. {
  165. name: '全部状态',
  166. value: 999
  167. },
  168. {
  169. name: '有效',
  170. value: 1
  171. },
  172. {
  173. name: '审核中',
  174. value: 2
  175. },
  176. {
  177. name: '无效',
  178. value: 3
  179. }
  180. ]
  181. },
  182. {
  183. name: '客户进度',
  184. type: 'hierarchy',
  185. submenu: [
  186. {
  187. name: '全部进度',
  188. value: 999
  189. },
  190. {
  191. name: '未到访',
  192. value: 1
  193. },
  194. {
  195. name: '已到访',
  196. value: 2
  197. },
  198. {
  199. name: '已认购',
  200. value: 3
  201. },
  202. {
  203. name: '已签约',
  204. value: 4
  205. },
  206. {
  207. name: '已结佣',
  208. value: 5
  209. }
  210. ]
  211. },
  212. {
  213. name: '排序',
  214. type: 'hierarchy',
  215. submenu: [
  216. {
  217. name: '时间近到远',
  218. value: 1
  219. },
  220. {
  221. name: '时间远到近',
  222. value: 2
  223. },
  224. // {
  225. // name: '预期佣金高到底',
  226. // value: 2
  227. // },
  228. // {
  229. // name: '预期佣金低到高',
  230. // value: 3
  231. // }
  232. ]
  233. }
  234. ],
  235. filterHours: 0,
  236. filterPropertyId: 999,
  237. filterVerifyStatus: 999,
  238. filterStepStatus: 999,
  239. orderMethod: 0,
  240. filterDropdownValue: {}, // 默认筛选
  241. customerList: [], // 客户列表
  242. stepList: ['审核中', '未到访', '已到访', '已认购', '已签约', '已结佣'],
  243. loadmore: {
  244. status: 'loadmore',
  245. loadingText: '努力加载中',
  246. defaultText: '轻轻上拉 查看更多',
  247. nomoreText: '实在没有了',
  248. currnetPage: 1
  249. },
  250. curRoles: '',
  251. userInfo2: {},
  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. },
  292. onReachBottom() {
  293. if (that.loadmore.status == 'nomore') return;
  294. that.loadmore.currnetPage++
  295. this.getDataList()
  296. },
  297. onPullDownRefresh() {
  298. // 防止频繁刷新
  299. },
  300. methods: {
  301. copyTextHandle (item) {
  302. uniCopy({
  303. content: `${item.name}-${item.sex == 'male'?'男':'女'}-${item.phone}`,
  304. success:(res)=>{
  305. uni.showToast({
  306. title: res,
  307. icon: 'none'
  308. })
  309. },
  310. error:(e)=>{
  311. uni.showToast({
  312. title: e,
  313. icon: 'none',
  314. duration:3000,
  315. })
  316. }
  317. })
  318. },
  319. getDataList (bc) {
  320. const that = this
  321. let params = {
  322. ...this.searchFormData
  323. }
  324. if (that.filterHours > 0) {
  325. let d = +new Date()
  326. params.start_at = parseInt((d - 1000 * 60 * 60 * that.filterHours) / 1000)
  327. params.end_at = parseInt(d / 1000)
  328. }
  329. if (that.filterVerifyStatus < 999) {
  330. params.report_state = that.filterVerifyStatus
  331. }
  332. if (that.filterStepStatus < 999) {
  333. params.report_step = that.filterStepStatus
  334. }
  335. if (that.filterPropertyId < 999) {
  336. params.estate_id = that.filterPropertyId
  337. }
  338. if (that.orderMethod > 0) {
  339. if (that.orderMethod === 1) {
  340. params.order_by = JSON.stringify([{
  341. field: 'create_at',
  342. sort: 'desc',
  343. }])
  344. }
  345. if (that.orderMethod === 2) {
  346. params.order_by = JSON.stringify([{
  347. field: 'create_at',
  348. sort: 'asc',
  349. }])
  350. }
  351. }
  352. uni.api.estate.apireportlist({
  353. page: that.loadmore.currnetPage,
  354. ...params,
  355. }).then(res => {
  356. const list = res.list || []
  357. if (list.length < 10) {
  358. that.loadmore.status = 'nomore';
  359. }
  360. if (res.current_page === 1) {
  361. if (list.length === 0) {
  362. uni.$msg('无搜索结果', 'none');
  363. }
  364. that.customerList = [...list]
  365. } else {
  366. that.customerList = that.customerList.concat(list)
  367. }
  368. if (bc) bc()
  369. })
  370. },
  371. customBack() {
  372. uni.navigateBack();
  373. },
  374. // 带监听器跳转
  375. pageTo(url, data) {
  376. /// xxxxx
  377. uni.navigateTo({
  378. url: url,
  379. events: {
  380. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  381. update: function(data) {
  382. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  383. }
  384. },
  385. success: function(res) {
  386. // 通过eventChannel向被打开页面传送数据
  387. res.eventChannel.emit('data', data);
  388. }
  389. });
  390. },
  391. searchHandle() {
  392. that.loadmore.currnetPage = 1
  393. this.getDataList(() => {
  394. this.searchPopupShow = false
  395. })
  396. },
  397. // 筛选
  398. confirmFilter(e) {
  399. if (e['value'][0][0] !== null) that.filterHours = e['value'][0][0];
  400. if (e['value'][1][0] !== null) that.filterPropertyId = e['value'][1][0];
  401. if (e['value'][2][0] !== null) that.filterVerifyStatus = e['value'][2][0];
  402. if (e['value'][3][0] !== null) that.filterStepStatus = e['value'][3][0];
  403. if (e['value'][4][0] !== null) that.orderMethod = e['value'][4][0];
  404. that.loadmore.currnetPage = 1;
  405. this.getDataList()
  406. },
  407. getTime(n) {
  408. let date = n ? new Date(n) : new Date()
  409. let year = date.getFullYear()
  410. let month = date.getMonth() + 1
  411. month = month > 9 ? month : '0' + month
  412. let day = date.getDate()
  413. day = day > 9 ? day : '0' + day
  414. let hour = date.getHours()
  415. hour = hour > 9 ? hour : '0' + hour
  416. let min = date.getMinutes()
  417. min = min > 9 ? min : '0' + min
  418. return year + '-' + month + '-' + day
  419. },
  420. }
  421. };
  422. </script>
  423. <style lang="scss">
  424. .search-wrap {
  425. padding: 20rpx;
  426. }
  427. .filter-wrap {
  428. position: relative;
  429. }
  430. // 列表
  431. .customer-list-wrap {
  432. margin-top: 80rpx;
  433. width: 100%;
  434. .customer-item {
  435. display: flex;
  436. flex-direction: column;
  437. align-items: flex-start;
  438. font-size: $u-p2;
  439. color: $u-content-color;
  440. border-bottom: 1rpx solid $u-border-color;
  441. padding: 24rpx 32rpx;
  442. .info {
  443. display: flex;
  444. align-items: flex-start;
  445. justify-content: space-between;
  446. width: 100%;
  447. margin-bottom: 10rpx;
  448. .customer {
  449. display: flex;
  450. flex-direction: column;
  451. align-items: flex-start;
  452. .relname {
  453. color: $u-main-color;
  454. font-size: $u-p;
  455. font-weight: bold;
  456. margin-bottom: 10rpx;
  457. }
  458. .item {
  459. margin-bottom: 10rpx;
  460. }
  461. }
  462. .data-wrap {
  463. text-align: right;
  464. .date {
  465. font-size: $u-sub;
  466. }
  467. }
  468. }
  469. .tool-wrap {
  470. display: flex;
  471. align-items: center;
  472. justify-content: space-between;
  473. width: 100%;
  474. }
  475. }
  476. }
  477. .float-search {
  478. opacity: 0.9;
  479. position: fixed;
  480. right: 20rpx;
  481. bottom: 40rpx;
  482. padding: 20rpx;
  483. border-radius: 50%;
  484. background-color: $u-theme-color;
  485. }
  486. .scoped-list-more-info {
  487. position: absolute;
  488. right: 20rpx;
  489. }
  490. </style>