index.vue 17 KB

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