index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <template>
  2. <view class="page u-skeleton">
  3. <!-- 经纪人信息卡片 -->
  4. <view class="userinfo-wrap u-skeleton-fillet box-shadow">
  5. <!-- 个人信息 -->
  6. <view class="userinfo">
  7. <view class="user">
  8. <view class="avatar-wrap">
  9. <u-avatar
  10. class="u-skeleton-circle"
  11. :src="userInfo.avatar"
  12. size="128"
  13. mode="circle"
  14. ></u-avatar>
  15. <!-- :show-level="true" -->
  16. <view class="avatar-bg box-shadow"></view>
  17. </view>
  18. <view class="info">
  19. <view class="nickname u-skeleton-rect">
  20. {{userInfo.user_id ? userInfo.nickname ? userInfo.nickname : '未设置用户名' : '未登录'}}
  21. </view>
  22. </view>
  23. <image v-if="userInfo && userInfo.manage_type == 2" src="../../static/bg_scan.png" class="scoped-scan-img" @click="scanHandle"></image>
  24. </view>
  25. <u-button
  26. v-if="!userInfo.user_id"
  27. class="u-skeleton-fillet"
  28. size="mini"
  29. type="primary"
  30. @click="pageTo('/pages/user/login/login')"
  31. :customStyle="{ margin: 0 }"
  32. >
  33. 立即登录
  34. </u-button>
  35. <u-button
  36. v-if="userInfo.user_id"
  37. <u-icon name="/static/icon/setting.png" size="24"></u-icon>
  38. </u-button>
  39. </view>
  40. <u-line length="650rpx" margin="30rpx 0 0"></u-line>
  41. <!-- 数据信息 -->
  42. <view class="datainfo">
  43. <view class="data-item" @click="pageTo('/pages/agent/recommend/list?filterStepStatus=1')">
  44. <view class="data u-skeleton-fillet">{{reportStepCountObj['1'] || 0}}</view>
  45. <view class="item u-skeleton-fillet">未到访</view>
  46. </view>
  47. <view class="data-item" @click="pageTo('/pages/agent/recommend/list?filterStepStatus=2')">
  48. <view class="data u-skeleton-fillet">{{reportStepCountObj['2'] || 0}}</view>
  49. <view class="item u-skeleton-fillet">已到访</view>
  50. </view>
  51. <view class="data-item" @click="pageTo('/pages/agent/recommend/list?filterStepStatus=3')">
  52. <view class="data u-skeleton-fillet">{{reportStepCountObj['3'] || 0}}</view>
  53. <view class="item u-skeleton-fillet">已认购</view>
  54. </view>
  55. <view class="data-item" @click="pageTo('/pages/agent/recommend/list?filterStepStatus=4')">
  56. <view class="data u-skeleton-fillet">
  57. {{reportStepCountObj['4'] || 0}}
  58. </view>
  59. <view class="item u-skeleton-fillet">已签约</view>
  60. </view>
  61. <view class="data-item" @click="pageTo('/pages/agent/recommend/list?filterStepStatus=5')">
  62. <view class="data u-skeleton-fillet">{{reportStepCountObj['5'] || 0}}</view>
  63. <view class="item u-skeleton-fillet">已结佣</view>
  64. </view>
  65. </view>
  66. </view>
  67. <!-- 功能卡片 -->
  68. <view class="function-card-wrap">
  69. <view class="col-card-wrap">
  70. <view class="function-card box-shadow u-skeleton-fillet" @click="pageTo('/pages/agent/recommend/create')">
  71. <view class="title-wrap">
  72. <view class="main-title">
  73. <u-icon class="u-m-r-5" name="/static/icon/thump-up.png" size="32"></u-icon>
  74. ️我要推荐
  75. </view>
  76. <view class="sub-title u-line-1">Recommend</view>
  77. </view>
  78. <u-image src="/static/icon/wenli1.png" mode="heightFix" height="144rpx" class="icon"></u-image>
  79. </view>
  80. <view class="function-card box-shadow u-skeleton-fillet" @click="pageTo('/pages/agent/recommend/list')">
  81. <view class="title-wrap">
  82. <view class="main-title">
  83. <u-icon class="u-m-r-5" name="/static/icon/money.png" size="32"></u-icon>
  84. 我的报备
  85. </view>
  86. <view class="sub-title u-line-1">Filing</view>
  87. </view>
  88. <u-image src="/static/icon/wenli2.png" mode="heightFix" height="144rpx" class="icon"></u-image>
  89. </view>
  90. </view>
  91. <view class="col-card-wrap">
  92. <view class="function-card box-shadow u-skeleton-fillet" @click="pageTo('/pages/cust/list')">
  93. <view class="title-wrap">
  94. <view class="main-title">
  95. <u-icon class="u-m-r-5" name="/static/icon/customer.png" size="32"></u-icon>
  96. 我的客户
  97. </view>
  98. <view class="sub-title u-line-1">Customer</view>
  99. </view>
  100. <u-image src="/static/icon/wenli3.png" mode="heightFix" height="144rpx" class="icon"></u-image>
  101. </view>
  102. <view class="function-card box-shadow u-skeleton-fillet" @click="commonRulesShow = true">
  103. <view class="title-wrap">
  104. <view class="main-title">
  105. <u-icon class="u-m-r-5" name="/static/icon/book.png" size="32"></u-icon>
  106. 佣金政策
  107. </view>
  108. <view class="sub-title u-line-1">Rules</view>
  109. </view>
  110. <u-image src="/static/icon/wenli4.png" mode="heightFix" height="144rpx" class="icon"></u-image>
  111. </view>
  112. </view>
  113. </view>
  114. <!-- 项目卡片 -->
  115. <view class="card-list-wrap box-shadow u-m-b-20">
  116. <view class="header-title-warp">
  117. <view class="title u-skeleton-rect">
  118. <u-icon class="u-m-r-5" name="/static/icon/fire.png" size="36"></u-icon>
  119. 高佣热销
  120. </view>
  121. <view v-show="propertyList.length > 5" class="more u-skeleton-rect">
  122. 更多
  123. <u-icon name="arrow-right"></u-icon>
  124. </view>
  125. </view>
  126. <view v-if="propertyList.length == 0" class="u-m-t-40 u-m-b-40"><u-empty mode="list" text="暂无在售房源"></u-empty></view>
  127. <view :class="'property-row-wrap'">
  128. <view class="property-body u-skeleton-fillet box-shadow" v-for="(item, index) in propertyList" :key="index" @click="showDetail(index)">
  129. <view class="image-wrap">
  130. <text class="tag u-skeleton-rect">{{ item.sale_tag }}</text>
  131. <image class="u-skeleton-rect" :src="item.cover_image" mode="aspectFill"></image>
  132. </view>
  133. <view class="property-info-wrap">
  134. <view class="title u-skeleton-rect">{{ item.name }}</view>
  135. <view class="commission u-line-1 u-skeleton-rect">{{ item.commissionText }}</view>
  136. </view>
  137. </view>
  138. </view>
  139. </view>
  140. <!-- 平台佣金政策弹窗 -->
  141. <u-popup v-model="commonRulesShow" mode="center" width="80%" height="800rpx" border-radius="20" closeable>
  142. <view class="bwin-popup">
  143. <view class="popup-header">平台佣金政策</view>
  144. <view class="popup-body"><!-- <u-parse :html="xxxxxxxxxx"></u-parse> --></view>
  145. </view>
  146. </u-popup>
  147. <!-- 项目佣金政策信息弹窗 -->
  148. <u-popup v-model="propertyPopupShow" mode="center" width="80%" height="800rpx" border-radius="20" closeable>
  149. <view class="bwin-popup">
  150. <view class="popup-header">{{ propertyList[currentPropertyIndex].name + '佣金政策' }}</view>
  151. <view class="popup-body">
  152. <u-parse :html="propertyList[currentPropertyIndex].rulesInfo.des_content"></u-parse>
  153. <u-divider marginTop="20" marginBottom="20">详情</u-divider>
  154. <view class="property-info">
  155. <view class="item">
  156. <view class="item-title">营销中心:</view>
  157. <view class="item-info">{{ propertyList[currentPropertyIndex].address }}</view>
  158. </view>
  159. <view class="item">
  160. <view class="item-title">销售热线:</view>
  161. <view class="item-info">{{ propertyList[currentPropertyIndex].tel }}</view>
  162. </view>
  163. <view class="item">
  164. <view class="item-title">保护期:</view>
  165. <view class="item-info">{{ propertyList[currentPropertyIndex].rulesInfo.safe_time + '小时' }}</view>
  166. </view>
  167. </view>
  168. </view>
  169. </view>
  170. </u-popup>
  171. <!-- 骨架屏 -->
  172. <u-skeleton :loading="skeletonLoading" animation></u-skeleton>
  173. </view>
  174. </template>
  175. <script>
  176. var that;
  177. export default {
  178. data() {
  179. // 页面数据变量
  180. return {
  181. userInfo: {},
  182. skeletonLoading: true,
  183. agentTypeList: ['', '自由经纪人', '渠道经纪人', '老业主'],
  184. propertyList: [
  185. {
  186. name: '在售项目1',
  187. cover_image: 'https://zdcdn.2bwin.cn/uploads/20220501/af6eb9c2a5d462be10a15c2302e5e6b5.jpg',
  188. sale_tag: '刚需好盘',
  189. rulesInfo: {
  190. des: '内容加载中....',
  191. des_content: '内容加载中....'
  192. }
  193. },
  194. {
  195. name: '在售项目2',
  196. cover_image: 'https://zdcdn.2bwin.cn/uploads/20220501/f11aa1c5e2e091f6b1e8a1d58fbe9d5e.jpg',
  197. sale_tag: '佣金易拿',
  198. rulesInfo: {
  199. des: '内容加载中....',
  200. des_content: '内容加载中....'
  201. }
  202. }
  203. ],
  204. commonRulesShow: false,
  205. propertyPopupShow: false,
  206. currentPropertyIndex: 0,
  207. // init请求返回的数据
  208. data: {},
  209. // 表单请求数据
  210. form1: {},
  211. scrollTop: 0,
  212. reportStepCountObj: {}
  213. };
  214. },
  215. onPageScroll(e) {
  216. this.scrollTop = e.scrollTop;
  217. },
  218. // 监听 - 页面每次【加载时】执行(如:前进)
  219. onLoad(options = {}) {
  220. // that = this;
  221. // this.options = options;
  222. // this.init(options);
  223. },
  224. // 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
  225. onReady() {
  226. },
  227. // 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
  228. onShow() {
  229. this.init()
  230. },
  231. // 监听 - 页面每次【隐藏时】执行(如:返回)
  232. onHide() {},
  233. // 监听 - 页面触底部
  234. onReachBottom() {},
  235. // 监听 - 窗口尺寸变化(仅限:App、微信小程序)
  236. onResize() {},
  237. // 监听 - 点击右上角转发时
  238. onShareAppMessage(options) {},
  239. // 监听 - 页面创建时
  240. created() {},
  241. // 函数
  242. methods: {
  243. scanHandle () {
  244. uni.scanCode({
  245. success: function (res) {
  246. uni.navigateTo({
  247. url: `/pages/agent/recommend/detail2?id=${res.result}`
  248. })
  249. }
  250. })
  251. },
  252. // 页面数据初始化函数
  253. init(options) {
  254. const userInfo = uni.getStorageSync('MD_userInfo')
  255. this.userInfo = userInfo
  256. uni.api.estate.apireportcount().then(res => {
  257. const reportStepCount = res.report_step_count || []
  258. let reportStepCountObj = {}
  259. reportStepCount.forEach(item => {
  260. reportStepCountObj[item.report_step] = item.total || 0
  261. })
  262. this.reportStepCountObj = {...reportStepCountObj}
  263. })
  264. // uni.api.estate.apireportlist({
  265. // token: 'xxxx'
  266. // }).then(res => {
  267. // console.log(res)
  268. // })
  269. // uni.api.estate.apiestatelist().then(res => {
  270. // console.log(res)
  271. // })
  272. // let currentTime = Date.parse(new Date()) / 1000; // 秒级
  273. // // 初始化平台数据
  274. // let systemConfig = vk.vuex.get('$app.systemConfig');
  275. // if (!systemConfig.use_skeleton) {
  276. this.skeletonLoading = false;
  277. // }
  278. // if (vk.pubfn.isNull(systemConfig._id)) {
  279. // // 不存在则直接初始化
  280. // vk.callFunction({
  281. // url: 'client/agent/pub/getConfigInfo',
  282. // needAlert: false
  283. // }).then(res => {
  284. // vk.vuex.set('$app.systemConfig', res.config);
  285. // vk.vuex.set('$app.systemConfig.lastGetTime', currentTime);
  286. // });
  287. // } else {
  288. // let mathTime = ((currentTime - systemConfig.lastGetTime) / 3600).toFixed(2);
  289. // if (mathTime > systemConfig.cache_time) {
  290. // vk.callFunction({
  291. // url: 'client/agent/pub/getConfigInfo',
  292. // needAlert: false
  293. // }).then(res => {
  294. // vk.vuex.set('$app.systemConfig', res.config);
  295. // vk.vuex.set('$app.systemConfig.lastGetTime', currentTime);
  296. // });
  297. // }
  298. // }
  299. // // 请求经纪人个人数据
  300. // let lastInitAgentDataTime = vk.vuex.get('$user.history.lastInitAgentDataTime');
  301. // if (currentTime - lastInitAgentDataTime >= 60 && vk.checkToken()) {
  302. // // 个人数据1分钟主动更新1次
  303. // vk.callFunction({
  304. // url: 'client/agent/kh/getAgentData',
  305. // data: {
  306. // agentId: vk.vuex.get('$user.agentInfo._id')
  307. // },
  308. // needAlert: false
  309. // }).then(res => {
  310. // vk.vuex.set('$user.dataInfo.recommendNum', res.data.recommendNum);
  311. // vk.vuex.set('$user.dataInfo.visitedNum', res.data.visitedNum);
  312. // vk.vuex.set('$user.dataInfo.buyNum', res.data.buyNum);
  313. // vk.vuex.set('$user.dataInfo.totalCommission', res.data.totalCommission);
  314. // vk.vuex.set('$user.history.lastInitAgentDataTime', currentTime);
  315. // });
  316. // }
  317. // // 请求未读消息数量
  318. // // 最快1分钟请求一次
  319. // let lastGetUnreadMsgTime = vk.vuex.get('$user.history.lastGetUnreadMsgTime');
  320. // if (currentTime - lastGetUnreadMsgTime > 60 && vk.checkToken()) {
  321. // vk.callFunction({
  322. // url: 'client/agent/kh/getUnreadMsgNum'
  323. // }).then(res => {
  324. // vk.vuex.set('$user.dataInfo.unreadMsgNum', res.num);
  325. // vk.vuex.set('$user.history.lastGetUnreadMsgTime', currentTime);
  326. // });
  327. // }
  328. // // 请求在售项目列表
  329. // vk.callFunction({
  330. // url: 'client/agent/pub/getPropertyList',
  331. // needAlert: false
  332. // }).then(res => {
  333. // that.propertyList = res.list;
  334. // // 存储到vuex,方便其他页面调用
  335. // if (res.list.length < 5) {
  336. // // 若大于等于5则可能有更多项目,则不缓存
  337. // let list = res.list.map(function(val, index) {
  338. // return { value: val._id, label: val.name };
  339. // });
  340. // vk.vuex.set('$app.propertyList', list);
  341. // }
  342. // // 拼接佣金政策
  343. // // 非经纪人身份时显示佣金政策简介
  344. // // 否则显示最高可获得的佣金额度
  345. // let i;
  346. // for (i = 0; i < res.list.length; i++) {
  347. // let agentType = vk.vuex.get('$user.agentInfo.type');
  348. // if (vk.pubfn.isNull(agentType)) {
  349. // // 还未注册为经纪人
  350. // that.propertyList[i].commissionText = that.propertyList[i].rulesInfo.des;
  351. // } else {
  352. // let commissionInfo = that.propertyList[i].rulesInfo.commission_info;
  353. // let item = vk.pubfn.getListItem(commissionInfo, 'type', agentType);
  354. // that.propertyList[i].commissionText = '您最高可获得佣金' + item.amount + '元';
  355. // }
  356. // }
  357. // that.skeletonLoading = false;
  358. // });
  359. },
  360. pageTo(path) {
  361. if (path === 'dev') {
  362. uni.$msg('开发中~')
  363. return
  364. }
  365. uni.navigateTo({
  366. url: path
  367. })
  368. },
  369. // 弹窗展示项目佣金详情
  370. showDetail(index) {
  371. that.currentPropertyIndex = index;
  372. that.propertyPopupShow = true;
  373. }
  374. },
  375. // 监听器
  376. watch: {},
  377. // 计算属性
  378. computed: {}
  379. };
  380. </script>
  381. <style lang="scss" scoped>
  382. .page {
  383. min-height: calc(100vh - 44px);
  384. }
  385. .userinfo-wrap {
  386. display: flex;
  387. flex-direction: column;
  388. align-items: flex-start;
  389. background-color: #fff;
  390. padding: 32rpx;
  391. width: 100%;
  392. margin-bottom: 20rpx;
  393. border-radius: 10rpx;
  394. position: relative;
  395. .userinfo {
  396. width: 100%;
  397. display: flex;
  398. align-items: center;
  399. justify-content: space-between;
  400. .user {
  401. display: flex;
  402. align-items: center;
  403. .avatar-wrap {
  404. position: relative;
  405. .avatar-bg {
  406. position: absolute;
  407. left: 0;
  408. top: 0;
  409. border-radius: 50%;
  410. width: 128rpx;
  411. height: 128rpx;
  412. }
  413. }
  414. .info {
  415. margin-left: 32rpx;
  416. .nickname {
  417. font-size: $u-p;
  418. font-weight: bold;
  419. color: $u-main-color;
  420. margin-bottom: 5rpx;
  421. }
  422. .mobile {
  423. font-size: $u-p1;
  424. color: $u-tips-color;
  425. }
  426. }
  427. }
  428. }
  429. .datainfo {
  430. width: 100%;
  431. display: flex;
  432. align-items: flex-end;
  433. justify-content: space-between;
  434. padding: 20rpx 0 0;
  435. .data-item {
  436. display: flex;
  437. flex-direction: column;
  438. align-items: center;
  439. .data {
  440. font-weight: bold;
  441. font-size: $u-h2;
  442. line-height: $u-h2;
  443. margin-bottom: 10rpx;
  444. }
  445. .item {
  446. font-size: $u-p2;
  447. color: $u-content-color;
  448. }
  449. }
  450. }
  451. }
  452. .function-card-wrap {
  453. .col-card-wrap {
  454. display: flex;
  455. align-items: center;
  456. justify-content: space-between;
  457. }
  458. .function-card {
  459. background-color: #fff;
  460. padding: 32rpx 20rpx;
  461. width: 345rpx;
  462. margin-bottom: 20rpx;
  463. border-radius: 10rpx;
  464. position: relative;
  465. overflow: hidden;
  466. .title-wrap {
  467. text-align: left;
  468. .main-title {
  469. display: flex;
  470. align-items: center;
  471. font-size: $u-p;
  472. font-weight: bold;
  473. }
  474. .sub-title {
  475. font-size: $u-p2;
  476. color: $u-content-color;
  477. }
  478. }
  479. .icon {
  480. text-align: right;
  481. position: absolute;
  482. top: 0;
  483. right: 0;
  484. }
  485. }
  486. }
  487. // 项目列表
  488. .card-list-wrap {
  489. background-color: #fff;
  490. // margin: 0rpx -20rpx 20rpx;
  491. padding: 20rpx 20rpx 0 20rpx;
  492. display: flex;
  493. flex-direction: column;
  494. border-radius: 10rpx;
  495. .header-title-warp {
  496. width: 100%;
  497. margin-bottom: 20rpx;
  498. display: flex;
  499. align-items: center;
  500. justify-content: space-between;
  501. .title {
  502. display: flex;
  503. align-items: center;
  504. color: $u-main-color;
  505. font-weight: bold;
  506. font-size: $u-p;
  507. }
  508. .more {
  509. font-size: $u-sub;
  510. color: $u-tips-color;
  511. }
  512. }
  513. // 行版
  514. .property-row-wrap {
  515. .property-body {
  516. width: 100%;
  517. border-radius: 10rpx;
  518. margin-bottom: 20rpx;
  519. // background-color: #fff;
  520. .image-wrap {
  521. position: relative;
  522. image {
  523. width: 100%;
  524. height: 300rpx;
  525. display: block;
  526. border-top-left-radius: 10rpx;
  527. border-top-right-radius: 10rpx;
  528. }
  529. .tag {
  530. color: #ffffff;
  531. background-color: $u-theme-color;
  532. font-size: $u-p2;
  533. position: absolute;
  534. z-index: 1;
  535. left: 0;
  536. padding: 8rpx 20rpx;
  537. border-top-left-radius: 10rpx;
  538. border-bottom-right-radius: 10rpx;
  539. }
  540. }
  541. .property-info-wrap {
  542. padding: 20rpx;
  543. .title {
  544. font-weight: bold;
  545. color: $u-main-color;
  546. font-size: $u-p;
  547. }
  548. .commission {
  549. margin-top: 10rpx;
  550. font-size: $u-p2;
  551. color: $u-content-color;
  552. }
  553. }
  554. }
  555. }
  556. // 两列版
  557. .property-col-wrap {
  558. display: flex;
  559. flex-wrap: wrap;
  560. justify-content: space-between;
  561. align-items: flex-start;
  562. .property-body {
  563. width: 325rpx;
  564. border-radius: 10rpx;
  565. margin-bottom: 20rpx;
  566. // background-color: #fff;
  567. .image-wrap {
  568. position: relative;
  569. image {
  570. width: 100%;
  571. height: 300rpx;
  572. display: block;
  573. border-top-left-radius: 10rpx;
  574. border-top-right-radius: 10rpx;
  575. }
  576. .tag {
  577. color: #ffffff;
  578. background-color: $u-theme-color;
  579. font-size: $u-sub;
  580. position: absolute;
  581. z-index: 1;
  582. left: 0;
  583. padding: 8rpx 20rpx;
  584. border-top-left-radius: 10rpx;
  585. border-bottom-right-radius: 10rpx;
  586. }
  587. }
  588. .property-info-wrap {
  589. padding: 20rpx;
  590. .title {
  591. font-weight: bold;
  592. color: $u-main-color;
  593. font-size: $u-p2;
  594. }
  595. .commission {
  596. margin-top: 10rpx;
  597. font-size: $u-sub;
  598. color: $u-content-color;
  599. }
  600. }
  601. }
  602. }
  603. }
  604. .popup-body {
  605. .property-info {
  606. font-size: $u-p1;
  607. .item {
  608. display: flex;
  609. margin-bottom: 10rpx;
  610. .item-title {
  611. font-weight: bold;
  612. }
  613. }
  614. }
  615. }
  616. .scoped-scan-img {
  617. padding-left: 20px;
  618. width: 90rpx;
  619. height: 90rpx;
  620. }
  621. </style>