houseDetail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  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. this.signJsapiTicket();
  130. },
  131. components: {
  132. backHome
  133. },
  134. mounted() {
  135. this.color1 = app.globalData.color1;
  136. this.color2 = app.globalData.color2;
  137. this.color3 = app.globalData.color3;
  138. this.color6 = app.globalData.color6;
  139. this.detailDatahandle()
  140. uni.$on("request", () => {
  141. this.detailDatahandle()
  142. })
  143. },
  144. methods: {
  145. async signJsapiTicket(){
  146. let parmas = {
  147. url:location.origin+location.pathname + "?projectId="+this.projectId+"&shareToken="+getApp().globalData.shareToken,
  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"] // 必填,需要使用的JS接口列表
  164. });
  165. wx.showMenuItems({
  166. menuList: [ "menuItem:share:appMessage","menuItem:share:timeline"] // 要显示的菜单项,所有menu项见附录3
  167. });
  168. wx.ready(function() {
  169. // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
  170. wx.updateAppMessageShareData({ //分享给朋友
  171. title: '项目详情', // 分享标题
  172. desc: self.dataInfo.shareRemark, // 分享描述
  173. link: location.origin+location.pathname + "?projectId="+this.projectId+"&shareToken="+getApp().globalData.shareToken, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  174. imgUrl: self.dataInfo.shareImg, // 分享图标
  175. success: function() {
  176. // 设置成功
  177. }
  178. });
  179. wx.updateTimelineShareData({ //分享到朋友圈
  180. title: '项目详情', // 分享标题
  181. link: location.origin+location.pathname + "?projectId="+this.projectId+"&shareToken="+getApp().globalData.shareToken, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  182. imgUrl: self.dataInfo.shareImg, // 分享图标
  183. success: function() {
  184. // 设置成功
  185. }
  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. }
  211. }
  212. },
  213. async getRegistTask() {
  214. if (app.globalData.userId) {
  215. let res = await this.$myRequest({
  216. url: "/task/registTask",
  217. method: "GET",
  218. data: {
  219. userId: getApp().globalData.userId
  220. }
  221. })
  222. if (res.data.success) {
  223. this.registAmount = res.data.single.amount || null
  224. } else {
  225. this.registAmount = null;
  226. }
  227. }
  228. },
  229. async createUserProjectRlat() {
  230. if (getApp().globalData.userId) {
  231. var parmas = {
  232. projectId: this.projectId,
  233. shareToken: getApp().globalData.shareToken
  234. }
  235. let res = await this.$myRequest({
  236. url: '/user/createUserProjectRlat',
  237. data: parmas
  238. })
  239. if (res && res.data.success) {
  240. }
  241. }
  242. },
  243. reloadCategoryList() {
  244. var tempList = JSON.parse(JSON.stringify(this.dataInfo.categoryList || []))
  245. tempList.forEach((item, idx) => {
  246. item.value = '¥' + (parseFloat(item.amount || 0.00).toFixed(2)) + '/个'
  247. })
  248. this.categoryList = tempList
  249. this.categoryList.push({
  250. categoryName: '可获收益',
  251. value: this.dataInfo.availableIncome + '元'
  252. })
  253. },
  254. reloadInfos() {
  255. this.infos[0].value = this.timeFilterAction(this.dataInfo.openTime)
  256. this.infos[1].value = this.dataInfo.bizFormat
  257. if (this.dataInfo.maxPrice > 0) {
  258. this.infos[2].value = this.priceReload(this.dataInfo.minPrice) + '~' + this.priceReload(this.dataInfo
  259. .maxPrice) + '/m²'
  260. } else {
  261. this.infos[2].value = this.priceReload(this.dataInfo.minPrice) + '/m²'
  262. }
  263. if (this.dataInfo.maxTotalPrice > 0) {
  264. this.infos[3].value = this.priceReload(this.dataInfo.minTotalPrice) + '~' + this.priceReload(this
  265. .dataInfo.maxTotalPrice) + '/套'
  266. } else {
  267. this.infos[3].value = this.priceReload(this.dataInfo.minTotalPrice) + '/套'
  268. }
  269. this.infos[4].value = this.dataInfo.mainHouseType
  270. // this.infos[5].value = this.dataInfo.cusGroup
  271. this.infos.forEach((item, idx) => {
  272. if (!item.value) {
  273. item.value = '暂无'
  274. }
  275. })
  276. },
  277. timeFilterAction(val) {
  278. if (val) {
  279. return displayDateFormatChi(val * 1000)
  280. } else {
  281. return ''
  282. }
  283. },
  284. priceReload(val) {
  285. return parseFloat(val / 10000).toFixed(2) + '万'
  286. },
  287. toShareCard(type) {
  288. if (getApp().globalData.userId) {
  289. let href = location.origin + location.pathname;
  290. uni.navigateTo({
  291. url: '../shareCardPage/shareCardPage?page=' + href + "&projectId=" + this.projectId +
  292. "&type=" + type
  293. })
  294. } else {
  295. uni.$emit('unLogin')
  296. }
  297. },
  298. backAction() {
  299. uni.navigateBack({
  300. delta: 1
  301. })
  302. }
  303. },
  304. watch: {
  305. },
  306. onPullDownRefresh() {
  307. this.detailDatahandle();
  308. }
  309. }
  310. </script>
  311. <style lang="scss" scoped>
  312. page {
  313. width: 100vw;
  314. height: 100vh;
  315. background-color: #FFFFFF;
  316. }
  317. .content {
  318. width: 100%;
  319. height: 100%;
  320. overflow-y: scroll;
  321. position: relative;
  322. padding-bottom: 60rpx;
  323. box-sizing: border-box;
  324. .topImg {
  325. width: 100%;
  326. height: 480rpx;
  327. background-color: rgba($color: #000000, $alpha: 0.5);
  328. // 滤镜效果
  329. // -webkit-filter: grayscale(30%); /* Chrome, Safari, Opera */
  330. // filter: grayscale(30%);
  331. }
  332. .sectionA {
  333. padding: 0 30rpx;
  334. box-sizing: border-box;
  335. width: 100%;
  336. margin-top: 50rpx;
  337. .topSection {
  338. display: flex;
  339. justify-content: space-between;
  340. align-items: center;
  341. padding-left: 6rpx;
  342. box-sizing: border-box;
  343. .title {
  344. font-size: 44rpx;
  345. font-family: Verdana, Verdana-Bold;
  346. font-weight: 700;
  347. text-align: left;
  348. color: #262626;
  349. white-space: pre-wrap;
  350. max-width: 50%;
  351. }
  352. .tags {
  353. margin-left: 8rpx;
  354. display: flex;
  355. justify-content: flex-start;
  356. align-items: center;
  357. flex-wrap: wrap;
  358. flex-grow: 1;
  359. .item {
  360. padding: 0 18rpx;
  361. box-sizing: border-box;
  362. line-height: 40rpx;
  363. height: 40rpx;
  364. text-align: center;
  365. font-size: 20rpx;
  366. font-family: Verdana, Verdana-Regular;
  367. font-weight: 400;
  368. margin-left: 12rpx;
  369. }
  370. }
  371. .shareBtn {
  372. width: 140rpx;
  373. height: 52rpx;
  374. border-radius: 8px;
  375. box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.10);
  376. display: flex;
  377. align-items: center;
  378. font-size: 22rpx;
  379. font-family: Verdana, Verdana-Regular;
  380. font-weight: 400;
  381. text-align: left;
  382. color: #ffffff;
  383. .icon {
  384. width: 32rpx;
  385. height: 32rpx;
  386. margin-left: 10rpx;
  387. }
  388. }
  389. }
  390. .bottomSection {
  391. margin-top: 16rpx;
  392. display: flex;
  393. justify-content: flex-start;
  394. align-items: center;
  395. height: 80rpx;
  396. background: #f8f8f8;
  397. border-radius: 8rpx;
  398. .icon {
  399. width: 20rpx;
  400. height: 28rpx;
  401. margin-right: 14rpx;
  402. margin-left: 25rpx;
  403. }
  404. .name {
  405. font-size: 24rpx;
  406. font-family: Verdana, Verdana-Regular;
  407. font-weight: 400;
  408. text-align: left;
  409. color: #b1b1b1;
  410. }
  411. }
  412. }
  413. .sectionB {
  414. width: 100%;
  415. display: flex;
  416. align-items: center;
  417. padding: 40rpx 36rpx;
  418. box-sizing: border-box;
  419. flex-wrap: wrap;
  420. .item {
  421. width: calc((100% - 12rpx) / 3);
  422. min-width: calc((100% - 12rpx) / 3);
  423. max-width: calc((100% - 12rpx) / 3);
  424. .name {
  425. font-size: 24rpx;
  426. font-family: Verdana, Verdana-Regular;
  427. font-weight: 400;
  428. text-align: left;
  429. color: #b1b1b1;
  430. }
  431. .value {
  432. font-size: 32rpx;
  433. font-family: DIN Alternate, DIN Alternate-Bold;
  434. font-weight: 700;
  435. text-align: left;
  436. white-space: nowrap;
  437. color: #fd8f3c;
  438. }
  439. }
  440. }
  441. .sectionC {
  442. width: 100%;
  443. padding: 0 36rpx 76rpx 36rpx;
  444. box-sizing: border-box;
  445. display: flex;
  446. flex-wrap: wrap;
  447. .title {
  448. font-size: 28rpx;
  449. font-family: Verdana, Verdana-Bold;
  450. font-weight: 700;
  451. text-align: left;
  452. color: #171717;
  453. width: 100%;
  454. margin-bottom: 26rpx;
  455. }
  456. .line {
  457. width: 6rpx;
  458. height: 268rpx;
  459. background: linear-gradient(180deg, #ffd7b9, rgba(255, 215, 185, 0.00));
  460. border-radius: 4rpx;
  461. }
  462. .infos {
  463. margin-left: 30rpx;
  464. width: calc(100% - 36rpx);
  465. margin-top: -20rpx;
  466. display: flex;
  467. flex-wrap: wrap;
  468. align-items: center;
  469. justify-content: space-between;
  470. .item {
  471. width: 50%;
  472. .name {
  473. font-size: 24rpx;
  474. font-family: Verdana, Verdana-Regular;
  475. font-weight: 400;
  476. text-align: left;
  477. color: #b1b1b1;
  478. }
  479. .value {
  480. font-size: 24rpx;
  481. font-family: Verdana, Verdana-Regular;
  482. font-weight: 400;
  483. text-align: left;
  484. color: #262626;
  485. }
  486. }
  487. }
  488. }
  489. .sectionD {
  490. display: flex;
  491. justify-content: space-between;
  492. align-items: center;
  493. margin-left: 30rpx;
  494. width: calc(100% - 60rpx);
  495. height: 140rpx;
  496. background: linear-gradient(108deg, #ffb55f 9%, #f87523 96%);
  497. border-radius: 16rpx;
  498. padding: 0 20rpx 0 26rpx;
  499. box-sizing: border-box;
  500. .icon {
  501. width: 60rpx;
  502. height: 80rpx;
  503. margin-right: 20rpx;
  504. }
  505. .midSection {
  506. flex-grow: 1;
  507. .name {
  508. font-size: 30rpx;
  509. font-family: Verdana, Verdana-Bold;
  510. font-weight: 700;
  511. text-align: left;
  512. color: #ffffff;
  513. }
  514. .value {
  515. font-size: 24rpx;
  516. font-family: Verdana, Verdana-Regular;
  517. font-weight: 400;
  518. text-align: left;
  519. color: #ffead8;
  520. }
  521. }
  522. .invitationBtn {
  523. width: 140rpx;
  524. height: 56rpx;
  525. border-radius: 12rpx;
  526. background-color: #FFFFFF;
  527. font-size: 24rpx;
  528. font-family: Verdana, Verdana-Bold;
  529. font-weight: 700;
  530. text-align: center;
  531. color: #f07423;
  532. line-height: 56rpx;
  533. }
  534. }
  535. }
  536. </style>