houseDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <view class="content">
  3. <image class="topImg" :src="dataInfo.projectFocusImage" 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. let money = parseFloat(val / 10000);
  278. if(String(money).indexOf('.')>-1){
  279. return parseFloat(val / 10000).toFixed(2) + '万'
  280. }else{
  281. return parseFloat(val / 10000) + '万'
  282. }
  283. },
  284. toShareCard(type) {
  285. if (getApp().globalData.token) {
  286. let href = location.origin + location.pathname;
  287. uni.navigateTo({
  288. url: '../shareCardPage/shareCardPage?page=' + href + "&projectId=" + this.projectId +
  289. "&type=" + type
  290. })
  291. } else {
  292. uni.$emit('unLogin')
  293. }
  294. },
  295. backAction() {
  296. uni.navigateBack({
  297. delta: 1
  298. })
  299. }
  300. },
  301. watch: {
  302. },
  303. onPullDownRefresh() {
  304. this.detailDatahandle();
  305. }
  306. }
  307. </script>
  308. <style lang="scss" scoped>
  309. page {
  310. width: 100vw;
  311. height: 100vh;
  312. background-color: #FFFFFF;
  313. }
  314. .content {
  315. width: 100%;
  316. height: 100%;
  317. overflow-y: scroll;
  318. position: relative;
  319. padding-bottom: 60rpx;
  320. box-sizing: border-box;
  321. .topImg {
  322. width: 100%;
  323. height: 480rpx;
  324. background-color: rgba($color: #000000, $alpha: 0.5);
  325. // 滤镜效果
  326. // -webkit-filter: grayscale(30%); /* Chrome, Safari, Opera */
  327. // filter: grayscale(30%);
  328. }
  329. .sectionA {
  330. padding: 0 30rpx;
  331. box-sizing: border-box;
  332. width: 100%;
  333. margin-top: 50rpx;
  334. .topSection {
  335. display: flex;
  336. justify-content: space-between;
  337. align-items: center;
  338. padding-left: 6rpx;
  339. box-sizing: border-box;
  340. .title {
  341. font-size: 44rpx;
  342. font-family: Verdana, Verdana-Bold;
  343. font-weight: 700;
  344. text-align: left;
  345. color: #262626;
  346. white-space: pre-wrap;
  347. max-width: 50%;
  348. }
  349. .tags {
  350. margin-left: 8rpx;
  351. display: flex;
  352. justify-content: flex-start;
  353. align-items: center;
  354. flex-wrap: wrap;
  355. flex-grow: 1;
  356. .item {
  357. padding: 0 18rpx;
  358. box-sizing: border-box;
  359. line-height: 40rpx;
  360. height: 40rpx;
  361. text-align: center;
  362. font-size: 20rpx;
  363. font-family: Verdana, Verdana-Regular;
  364. font-weight: 400;
  365. margin-left: 12rpx;
  366. }
  367. }
  368. .shareBtn {
  369. width: 142rpx;
  370. min-width: 142rpx;
  371. height: 52rpx;
  372. border-radius: 8px;
  373. box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.10);
  374. display: flex;
  375. align-items: center;
  376. font-size: 22rpx;
  377. font-family: Verdana, Verdana-Regular;
  378. font-weight: 400;
  379. text-align: left;
  380. color: #ffffff;
  381. white-space: nowrap;
  382. .icon {
  383. width: 32rpx;
  384. height: 32rpx;
  385. margin-left: 10rpx;
  386. }
  387. }
  388. }
  389. .bottomSection {
  390. margin-top: 16rpx;
  391. display: flex;
  392. justify-content: flex-start;
  393. align-items: center;
  394. height: 80rpx;
  395. background: #f8f8f8;
  396. border-radius: 8rpx;
  397. .icon {
  398. width: 20rpx;
  399. height: 28rpx;
  400. margin-right: 14rpx;
  401. margin-left: 25rpx;
  402. }
  403. .name {
  404. font-size: 24rpx;
  405. font-family: Verdana, Verdana-Regular;
  406. font-weight: 400;
  407. text-align: left;
  408. color: #b1b1b1;
  409. }
  410. }
  411. }
  412. .sectionB {
  413. width: 100%;
  414. display: flex;
  415. align-items: center;
  416. padding: 40rpx 36rpx;
  417. box-sizing: border-box;
  418. flex-wrap: wrap;
  419. .item {
  420. width: calc((100% - 12rpx) / 3);
  421. min-width: calc((100% - 12rpx) / 3);
  422. max-width: calc((100% - 12rpx) / 3);
  423. .name {
  424. font-size: 24rpx;
  425. font-family: Verdana, Verdana-Regular;
  426. font-weight: 400;
  427. text-align: left;
  428. color: #b1b1b1;
  429. }
  430. .value {
  431. font-size: 32rpx;
  432. font-family: DIN Alternate, DIN Alternate-Bold;
  433. font-weight: 700;
  434. text-align: left;
  435. white-space: nowrap;
  436. color: #fd8f3c;
  437. }
  438. }
  439. }
  440. .sectionC {
  441. width: 100%;
  442. padding: 0 36rpx 76rpx 36rpx;
  443. box-sizing: border-box;
  444. display: flex;
  445. flex-wrap: wrap;
  446. .title {
  447. font-size: 28rpx;
  448. font-family: Verdana, Verdana-Bold;
  449. font-weight: 700;
  450. text-align: left;
  451. color: #171717;
  452. width: 100%;
  453. margin-bottom: 26rpx;
  454. }
  455. .line {
  456. width: 6rpx;
  457. height: 268rpx;
  458. background: linear-gradient(180deg, #ffd7b9, rgba(255, 215, 185, 0.00));
  459. border-radius: 4rpx;
  460. }
  461. .infos {
  462. margin-left: 30rpx;
  463. width: calc(100% - 36rpx);
  464. margin-top: -20rpx;
  465. display: flex;
  466. flex-wrap: wrap;
  467. align-items: center;
  468. justify-content: space-between;
  469. .item {
  470. width: 50%;
  471. .name {
  472. font-size: 24rpx;
  473. font-family: Verdana, Verdana-Regular;
  474. font-weight: 400;
  475. text-align: left;
  476. color: #b1b1b1;
  477. }
  478. .value {
  479. font-size: 24rpx;
  480. font-family: Verdana, Verdana-Regular;
  481. font-weight: 400;
  482. text-align: left;
  483. color: #262626;
  484. }
  485. }
  486. }
  487. }
  488. .sectionD {
  489. display: flex;
  490. justify-content: space-between;
  491. align-items: center;
  492. margin-left: 30rpx;
  493. width: calc(100% - 60rpx);
  494. height: 140rpx;
  495. background: linear-gradient(108deg, #ffb55f 9%, #f87523 96%);
  496. border-radius: 16rpx;
  497. padding: 0 20rpx 0 26rpx;
  498. box-sizing: border-box;
  499. .icon {
  500. width: 60rpx;
  501. height: 80rpx;
  502. margin-right: 20rpx;
  503. }
  504. .midSection {
  505. flex-grow: 1;
  506. .name {
  507. font-size: 30rpx;
  508. font-family: Verdana, Verdana-Bold;
  509. font-weight: 700;
  510. text-align: left;
  511. color: #ffffff;
  512. }
  513. .value {
  514. font-size: 24rpx;
  515. font-family: Verdana, Verdana-Regular;
  516. font-weight: 400;
  517. text-align: left;
  518. color: #ffead8;
  519. }
  520. }
  521. .invitationBtn {
  522. width: 140rpx;
  523. height: 56rpx;
  524. border-radius: 12rpx;
  525. background-color: #FFFFFF;
  526. font-size: 24rpx;
  527. font-family: Verdana, Verdana-Bold;
  528. font-weight: 700;
  529. text-align: center;
  530. color: #f07423;
  531. line-height: 56rpx;
  532. }
  533. }
  534. }
  535. </style>