houseDetail.vue 13 KB

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