houseDetail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <template>
  2. <view class="content">
  3. <image class="topImg" :src="dataInfo.image" mode="aspectFill"></image>
  4. <view class="sectionA">
  5. <view class="topSection">
  6. <view class="title">{{dataInfo.name}}</view>
  7. <view class="tags">
  8. <view class="item" v-for="(item, idx) in dataInfo.categoryList" :key="idx"
  9. :style="`color: ${color2}; background-color: ${color6};`">{{item.categoryName}}</view>
  10. </view>
  11. <view class="shareBtn" :style="`background-color: ${color1};`" @click="toShareCard(2)">
  12. <image class="icon" src="https://dm.static.elab-plus.com/yezhu/h5/icon_share.png" mode="aspectFit">
  13. </image>
  14. <text>分享项目</text>
  15. </view>
  16. </view>
  17. <view class="bottomSection">
  18. <image class="icon" src="https://dm.static.elab-plus.com/yezhu/h5/icon_dingweiY.png" mode=""></image>
  19. <view class="name">{{dataInfo.province + dataInfo.city + dataInfo.district + dataInfo.address}}</view>
  20. </view>
  21. </view>
  22. <view class="sectionB">
  23. <view class="item" v-for="(item, idx) in categoryList" :key="idx">
  24. <view class="name">{{item.categoryName}}收益</view>
  25. <view class="value">{{item.value}}</view>
  26. </view>
  27. </view>
  28. <view class="sectionC">
  29. <view class="title">基本信息</view>
  30. <view class="line"></view>
  31. <view class="infos">
  32. <view class="item" v-for="(item, idx) in infos" :key="idx">
  33. <view class="name">{{item.title}}</view>
  34. <view class="value">{{item.value}}</view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="sectionD" v-if="registAmount">
  39. <image class="icon" src="https://dm.static.elab-plus.com/yezhu/icon_hongbao.png" mode="aspectFit"></image>
  40. <view class="midSection">
  41. <view class="name">邀请好友注册</view>
  42. <view class="value">完成邀请,可获得¥{{registAmount}}/人</view>
  43. </view>
  44. <view class="invitationBtn" @click="toShareCard(1)">邀请好友</view>
  45. </view>
  46. <backHome></backHome>
  47. <login-notice></login-notice>
  48. <login></login>
  49. </view>
  50. </template>
  51. <script>
  52. import moment from '../../static/moment.min.js'
  53. import {
  54. displayDateFormatChi
  55. } from '../../static/format.js'
  56. let app = getApp();
  57. const config = require('@/static/config.js');
  58. import backHome from "@/components/backHome/backHome.vue";
  59. const wx = require('weixin-js-sdk');
  60. export default {
  61. data() {
  62. return {
  63. color1: '',
  64. color2: '',
  65. color3: '',
  66. color6: '',
  67. infos: [{
  68. title: '开盘时间',
  69. value: ''
  70. },
  71. {
  72. title: '项目业态',
  73. value: ''
  74. },
  75. {
  76. title: '均价',
  77. value: ''
  78. },
  79. {
  80. title: '总价',
  81. value: ''
  82. },
  83. {
  84. title: '主力户型',
  85. value: ''
  86. }
  87. // {
  88. // title: '目标人群',
  89. // value: ''
  90. // }
  91. ],
  92. projectId: '',
  93. dataInfo: {
  94. "address": "",
  95. "availableIncome": "",
  96. "bizFormat": "",
  97. "categoryList": [],
  98. "city": "",
  99. "cusGroup": "",
  100. "district": "",
  101. "id": 0,
  102. "image": "",
  103. "mainHouseType": "",
  104. "maxPrice": 0,
  105. "maxTotalPrice": 0,
  106. "minPrice": 0,
  107. "minTotalPrice": 0,
  108. "name": "",
  109. "onlineStatus": 0,
  110. "openTime": 0,
  111. "otherPage": "",
  112. "projectFocusImage": "",
  113. "projectId": "",
  114. "province": "",
  115. "registAmount": "",
  116. "revision": "",
  117. "shareImg": "",
  118. "shareRemark": "",
  119. "xcxPage": ""
  120. },
  121. categoryList: [],
  122. registAmount: null,
  123. }
  124. },
  125. onLoad(param) {
  126. this.projectId = param.projectId;
  127. },
  128. onShow() {
  129. },
  130. components: {
  131. backHome
  132. },
  133. mounted() {
  134. this.color1 = app.globalData.color1;
  135. this.color2 = app.globalData.color2;
  136. this.color3 = app.globalData.color3;
  137. this.color6 = app.globalData.color6;
  138. this.detailDatahandle()
  139. uni.$on("request", () => {
  140. this.detailDatahandle()
  141. })
  142. },
  143. methods: {
  144. async signJsapiTicket(){
  145. let url = location.href.split('#')[0]
  146. let parmas = {
  147. url: url,
  148. }
  149. let self = this;
  150. let res = await this.$myRequest({
  151. url: '/wechat/signJsapiTicket',
  152. data: parmas,
  153. method:"GET",
  154. });
  155. if(res.data.success){
  156. let single = res.data.single;
  157. wx.config({
  158. debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  159. appId: config.appid, // 必填,公众号的唯一标识
  160. timestamp: single.timestamp, // 必填,生成签名的时间戳
  161. nonceStr: single.nonceStr, // 必填,生成签名的随机串
  162. signature: single.signature, // 必填,签名
  163. jsApiList: ["updateAppMessageShareData","updateTimelineShareData",'showMenuItems'] // 必填,需要使用的JS接口列表
  164. });
  165. wx.ready(function() {
  166. // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
  167. wx.updateAppMessageShareData({ //分享给朋友
  168. title: self.dataInfo.name, // 分享标题
  169. desc: self.dataInfo.shareRemark, // 分享描述
  170. link: location.origin+location.pathname + "?projectId="+self.projectId+"&shareToken="+getApp().globalData.shareToken, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  171. imgUrl: self.dataInfo.shareImg, // 分享图标
  172. success: function() {
  173. // 设置成功
  174. }
  175. });
  176. wx.updateTimelineShareData({ //分享到朋友圈
  177. title: self.dataInfo.name, // 分享标题
  178. link: location.origin+location.pathname + "?projectId="+self.projectId+"&shareToken="+getApp().globalData.shareToken, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  179. imgUrl: self.dataInfo.shareImg, // 分享图标
  180. success: function() {
  181. // 设置成功
  182. }
  183. });
  184. wx.showMenuItems({
  185. menuList: [ "menuItem:share:appMessage","menuItem:share:timeline"] // 要显示的菜单项,所有menu项见附录3
  186. });
  187. });
  188. wx.error(function(res) {
  189. // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
  190. });
  191. }
  192. },
  193. async detailDatahandle() {
  194. if (getApp().globalData.userId) {
  195. var parmas = {
  196. projectId: this.projectId,
  197. userId: getApp().globalData.userId
  198. }
  199. this.createUserProjectRlat();
  200. this.getRegistTask();
  201. let res = await this.$myRequest({
  202. url: '/project/queryProjectByH5',
  203. data: parmas
  204. })
  205. if (res && res.data.success) {
  206. console.log('详情res:', res)
  207. this.dataInfo = res.data.single
  208. this.reloadCategoryList()
  209. this.reloadInfos();
  210. this.signJsapiTicket();
  211. }
  212. }
  213. },
  214. async getRegistTask() {
  215. if (app.globalData.userId) {
  216. let res = await this.$myRequest({
  217. url: "/task/registTask",
  218. method: "GET",
  219. data: {
  220. userId: getApp().globalData.userId
  221. }
  222. })
  223. if (res.data.success) {
  224. this.registAmount = res.data.single.amount || null
  225. } else {
  226. this.registAmount = null;
  227. }
  228. }
  229. },
  230. async createUserProjectRlat() {
  231. if (getApp().globalData.userId) {
  232. var parmas = {
  233. projectId: this.projectId,
  234. shareToken: getApp().globalData.shareToken
  235. }
  236. let res = await this.$myRequest({
  237. url: '/user/createUserProjectRlat',
  238. data: parmas
  239. })
  240. if (res && res.data.success) {
  241. }
  242. }
  243. },
  244. reloadCategoryList() {
  245. var tempList = JSON.parse(JSON.stringify(this.dataInfo.categoryList || []))
  246. tempList.forEach((item, idx) => {
  247. item.value = '¥' + (parseFloat(item.amount || 0.00).toFixed(2)) + '/个'
  248. })
  249. this.categoryList = tempList
  250. this.categoryList.push({
  251. categoryName: '可获收益',
  252. value: this.dataInfo.availableIncome + '元'
  253. })
  254. },
  255. reloadInfos() {
  256. this.infos[0].value = this.timeFilterAction(this.dataInfo.openTime)
  257. this.infos[1].value = this.dataInfo.bizFormat
  258. if (this.dataInfo.maxPrice > 0) {
  259. this.infos[2].value = this.priceReload(this.dataInfo.minPrice) + '~' + this.priceReload(this.dataInfo
  260. .maxPrice) + '/m²'
  261. } else {
  262. this.infos[2].value = this.priceReload(this.dataInfo.minPrice) + '/m²'
  263. }
  264. if (this.dataInfo.maxTotalPrice > 0) {
  265. this.infos[3].value = this.priceReload(this.dataInfo.minTotalPrice) + '~' + this.priceReload(this
  266. .dataInfo.maxTotalPrice) + '/套'
  267. } else {
  268. this.infos[3].value = this.priceReload(this.dataInfo.minTotalPrice) + '/套'
  269. }
  270. this.infos[4].value = this.dataInfo.mainHouseType
  271. // this.infos[5].value = this.dataInfo.cusGroup
  272. this.infos.forEach((item, idx) => {
  273. if (!item.value) {
  274. item.value = '暂无'
  275. }
  276. })
  277. },
  278. timeFilterAction(val) {
  279. if (val) {
  280. return displayDateFormatChi(val * 1000)
  281. } else {
  282. return ''
  283. }
  284. },
  285. priceReload(val) {
  286. return parseFloat(val / 10000).toFixed(2) + '万'
  287. },
  288. toShareCard(type) {
  289. if (getApp().globalData.userId) {
  290. let href = location.origin + location.pathname;
  291. uni.navigateTo({
  292. url: '../shareCardPage/shareCardPage?page=' + href + "&projectId=" + this.projectId +
  293. "&type=" + type
  294. })
  295. } else {
  296. uni.$emit('unLogin')
  297. }
  298. },
  299. backAction() {
  300. uni.navigateBack({
  301. delta: 1
  302. })
  303. }
  304. },
  305. watch: {
  306. },
  307. onPullDownRefresh() {
  308. this.detailDatahandle();
  309. }
  310. }
  311. </script>
  312. <style lang="scss" scoped>
  313. page {
  314. width: 100vw;
  315. height: 100vh;
  316. background-color: #FFFFFF;
  317. }
  318. .content {
  319. width: 100%;
  320. height: 100%;
  321. overflow-y: scroll;
  322. position: relative;
  323. padding-bottom: 60rpx;
  324. box-sizing: border-box;
  325. .topImg {
  326. width: 100%;
  327. height: 480rpx;
  328. background-color: rgba($color: #000000, $alpha: 0.5);
  329. // 滤镜效果
  330. // -webkit-filter: grayscale(30%); /* Chrome, Safari, Opera */
  331. // filter: grayscale(30%);
  332. }
  333. .sectionA {
  334. padding: 0 30rpx;
  335. box-sizing: border-box;
  336. width: 100%;
  337. margin-top: 50rpx;
  338. .topSection {
  339. display: flex;
  340. justify-content: space-between;
  341. align-items: center;
  342. padding-left: 6rpx;
  343. box-sizing: border-box;
  344. .title {
  345. font-size: 44rpx;
  346. font-family: Verdana, Verdana-Bold;
  347. font-weight: 700;
  348. text-align: left;
  349. color: #262626;
  350. white-space: pre-wrap;
  351. max-width: 50%;
  352. }
  353. .tags {
  354. margin-left: 8rpx;
  355. display: flex;
  356. justify-content: flex-start;
  357. align-items: center;
  358. flex-wrap: wrap;
  359. flex-grow: 1;
  360. .item {
  361. padding: 0 18rpx;
  362. box-sizing: border-box;
  363. line-height: 40rpx;
  364. height: 40rpx;
  365. text-align: center;
  366. font-size: 20rpx;
  367. font-family: Verdana, Verdana-Regular;
  368. font-weight: 400;
  369. margin-left: 12rpx;
  370. }
  371. }
  372. .shareBtn {
  373. width: 140rpx;
  374. height: 52rpx;
  375. border-radius: 8px;
  376. box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.10);
  377. display: flex;
  378. align-items: center;
  379. font-size: 22rpx;
  380. font-family: Verdana, Verdana-Regular;
  381. font-weight: 400;
  382. text-align: left;
  383. color: #ffffff;
  384. .icon {
  385. width: 32rpx;
  386. height: 32rpx;
  387. margin-left: 10rpx;
  388. }
  389. }
  390. }
  391. .bottomSection {
  392. margin-top: 16rpx;
  393. display: flex;
  394. justify-content: flex-start;
  395. align-items: center;
  396. height: 80rpx;
  397. background: #f8f8f8;
  398. border-radius: 8rpx;
  399. .icon {
  400. width: 20rpx;
  401. height: 28rpx;
  402. margin-right: 14rpx;
  403. margin-left: 25rpx;
  404. }
  405. .name {
  406. font-size: 24rpx;
  407. font-family: Verdana, Verdana-Regular;
  408. font-weight: 400;
  409. text-align: left;
  410. color: #b1b1b1;
  411. }
  412. }
  413. }
  414. .sectionB {
  415. width: 100%;
  416. display: flex;
  417. align-items: center;
  418. padding: 40rpx 36rpx;
  419. box-sizing: border-box;
  420. flex-wrap: wrap;
  421. .item {
  422. width: calc((100% - 12rpx) / 3);
  423. min-width: calc((100% - 12rpx) / 3);
  424. max-width: calc((100% - 12rpx) / 3);
  425. .name {
  426. font-size: 24rpx;
  427. font-family: Verdana, Verdana-Regular;
  428. font-weight: 400;
  429. text-align: left;
  430. color: #b1b1b1;
  431. }
  432. .value {
  433. font-size: 32rpx;
  434. font-family: DIN Alternate, DIN Alternate-Bold;
  435. font-weight: 700;
  436. text-align: left;
  437. white-space: nowrap;
  438. color: #fd8f3c;
  439. }
  440. }
  441. }
  442. .sectionC {
  443. width: 100%;
  444. padding: 0 36rpx 76rpx 36rpx;
  445. box-sizing: border-box;
  446. display: flex;
  447. flex-wrap: wrap;
  448. .title {
  449. font-size: 28rpx;
  450. font-family: Verdana, Verdana-Bold;
  451. font-weight: 700;
  452. text-align: left;
  453. color: #171717;
  454. width: 100%;
  455. margin-bottom: 26rpx;
  456. }
  457. .line {
  458. width: 6rpx;
  459. height: 268rpx;
  460. background: linear-gradient(180deg, #ffd7b9, rgba(255, 215, 185, 0.00));
  461. border-radius: 4rpx;
  462. }
  463. .infos {
  464. margin-left: 30rpx;
  465. width: calc(100% - 36rpx);
  466. margin-top: -20rpx;
  467. display: flex;
  468. flex-wrap: wrap;
  469. align-items: center;
  470. justify-content: space-between;
  471. .item {
  472. width: 50%;
  473. .name {
  474. font-size: 24rpx;
  475. font-family: Verdana, Verdana-Regular;
  476. font-weight: 400;
  477. text-align: left;
  478. color: #b1b1b1;
  479. }
  480. .value {
  481. font-size: 24rpx;
  482. font-family: Verdana, Verdana-Regular;
  483. font-weight: 400;
  484. text-align: left;
  485. color: #262626;
  486. }
  487. }
  488. }
  489. }
  490. .sectionD {
  491. display: flex;
  492. justify-content: space-between;
  493. align-items: center;
  494. margin-left: 30rpx;
  495. width: calc(100% - 60rpx);
  496. height: 140rpx;
  497. background: linear-gradient(108deg, #ffb55f 9%, #f87523 96%);
  498. border-radius: 16rpx;
  499. padding: 0 20rpx 0 26rpx;
  500. box-sizing: border-box;
  501. .icon {
  502. width: 60rpx;
  503. height: 80rpx;
  504. margin-right: 20rpx;
  505. }
  506. .midSection {
  507. flex-grow: 1;
  508. .name {
  509. font-size: 30rpx;
  510. font-family: Verdana, Verdana-Bold;
  511. font-weight: 700;
  512. text-align: left;
  513. color: #ffffff;
  514. }
  515. .value {
  516. font-size: 24rpx;
  517. font-family: Verdana, Verdana-Regular;
  518. font-weight: 400;
  519. text-align: left;
  520. color: #ffead8;
  521. }
  522. }
  523. .invitationBtn {
  524. width: 140rpx;
  525. height: 56rpx;
  526. border-radius: 12rpx;
  527. background-color: #FFFFFF;
  528. font-size: 24rpx;
  529. font-family: Verdana, Verdana-Bold;
  530. font-weight: 700;
  531. text-align: center;
  532. color: #f07423;
  533. line-height: 56rpx;
  534. }
  535. }
  536. }
  537. </style>