houseDetail.vue 15 KB

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