houseDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  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. shareToken:"",
  124. }
  125. },
  126. onLoad(param) {
  127. this.projectId = param.projectId;
  128. },
  129. onShow() {
  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 getSingle(){
  146. let params = {
  147. "projectId": this.projectId,
  148. "userId": getApp().globalData.userId
  149. }
  150. let res = await this.$myRequest({
  151. url: '/share_token/generate',
  152. data: params
  153. });
  154. if(res.data.success){
  155. this.shareToken = res.data.single;
  156. }
  157. },
  158. async detailDatahandle() {
  159. if (getApp().globalData.userId) {
  160. var parmas = {
  161. projectId: this.projectId,
  162. userId: getApp().globalData.userId
  163. }
  164. this.getSingle();
  165. this.createUserProjectRlat();
  166. this.getRegistTask();
  167. let res = await this.$myRequest({
  168. url: '/project/queryProjectByH5',
  169. data: parmas
  170. })
  171. if (res && res.data.success) {
  172. console.log('详情res:', res)
  173. this.dataInfo = res.data.single
  174. this.reloadCategoryList()
  175. this.reloadInfos();
  176. this.config(this.dataInfo.name,this.dataInfo.shareRemark,location.origin+location.pathname + "?projectId="+this.projectId+"&shareToken="+this.shareToken,this.dataInfo.shareImg)
  177. }
  178. }
  179. },
  180. async getRegistTask() {
  181. if (app.globalData.userId) {
  182. let res = await this.$myRequest({
  183. url: "/task/registTask",
  184. method: "GET",
  185. data: {
  186. userId: getApp().globalData.userId
  187. }
  188. })
  189. if (res.data.success) {
  190. this.registAmount = res.data.single.amount || null
  191. } else {
  192. this.registAmount = null;
  193. }
  194. }
  195. },
  196. async createUserProjectRlat() {
  197. if (getApp().globalData.userId) {
  198. var parmas = {
  199. projectId: this.projectId,
  200. shareToken: getApp().globalData.shareToken
  201. }
  202. let res = await this.$myRequest({
  203. url: '/user/createUserProjectRlat',
  204. data: parmas
  205. })
  206. if (res && res.data.success) {
  207. }
  208. }
  209. },
  210. reloadCategoryList() {
  211. var tempList = JSON.parse(JSON.stringify(this.dataInfo.categoryList || []))
  212. tempList.forEach((item, idx) => {
  213. item.value = '¥' + (parseFloat(item.amount || 0.00).toFixed(2)) + '/个'
  214. })
  215. this.categoryList = tempList
  216. this.categoryList.push({
  217. categoryName: '可获收益',
  218. value: this.dataInfo.availableIncome + '元'
  219. })
  220. },
  221. reloadInfos() {
  222. this.infos[0].value = this.timeFilterAction(this.dataInfo.openTime)
  223. this.infos[1].value = this.dataInfo.bizFormat
  224. if (this.dataInfo.maxPrice > 0) {
  225. this.infos[2].value = this.priceReload(this.dataInfo.minPrice) + '~' + this.priceReload(this.dataInfo
  226. .maxPrice) + '/m²'
  227. } else {
  228. this.infos[2].value = this.priceReload(this.dataInfo.minPrice) + '/m²'
  229. }
  230. if (this.dataInfo.maxTotalPrice > 0) {
  231. this.infos[3].value = this.priceReload(this.dataInfo.minTotalPrice) + '~' + this.priceReload(this
  232. .dataInfo.maxTotalPrice) + '/套'
  233. } else {
  234. this.infos[3].value = this.priceReload(this.dataInfo.minTotalPrice) + '/套'
  235. }
  236. this.infos[4].value = this.dataInfo.mainHouseType
  237. // this.infos[5].value = this.dataInfo.cusGroup
  238. this.infos.forEach((item, idx) => {
  239. if (!item.value) {
  240. item.value = '暂无'
  241. }
  242. })
  243. },
  244. timeFilterAction(val) {
  245. if (val) {
  246. return displayDateFormatChi(val * 1000)
  247. } else {
  248. return ''
  249. }
  250. },
  251. priceReload(val) {
  252. return parseFloat(val / 10000).toFixed(2) + '万'
  253. },
  254. toShareCard(type) {
  255. if (getApp().globalData.userId) {
  256. let href = location.origin + location.pathname;
  257. uni.navigateTo({
  258. url: '../shareCardPage/shareCardPage?page=' + href + "&projectId=" + this.projectId +
  259. "&type=" + type
  260. })
  261. } else {
  262. uni.$emit('unLogin')
  263. }
  264. },
  265. backAction() {
  266. uni.navigateBack({
  267. delta: 1
  268. })
  269. }
  270. },
  271. watch: {
  272. },
  273. onPullDownRefresh() {
  274. this.detailDatahandle();
  275. }
  276. }
  277. </script>
  278. <style lang="scss" scoped>
  279. page {
  280. width: 100vw;
  281. height: 100vh;
  282. background-color: #FFFFFF;
  283. }
  284. .content {
  285. width: 100%;
  286. height: 100%;
  287. overflow-y: scroll;
  288. position: relative;
  289. padding-bottom: 60rpx;
  290. box-sizing: border-box;
  291. .topImg {
  292. width: 100%;
  293. height: 480rpx;
  294. background-color: rgba($color: #000000, $alpha: 0.5);
  295. // 滤镜效果
  296. // -webkit-filter: grayscale(30%); /* Chrome, Safari, Opera */
  297. // filter: grayscale(30%);
  298. }
  299. .sectionA {
  300. padding: 0 30rpx;
  301. box-sizing: border-box;
  302. width: 100%;
  303. margin-top: 50rpx;
  304. .topSection {
  305. display: flex;
  306. justify-content: space-between;
  307. align-items: center;
  308. padding-left: 6rpx;
  309. box-sizing: border-box;
  310. .title {
  311. font-size: 44rpx;
  312. font-family: Verdana, Verdana-Bold;
  313. font-weight: 700;
  314. text-align: left;
  315. color: #262626;
  316. white-space: pre-wrap;
  317. max-width: 50%;
  318. }
  319. .tags {
  320. margin-left: 8rpx;
  321. display: flex;
  322. justify-content: flex-start;
  323. align-items: center;
  324. flex-wrap: wrap;
  325. flex-grow: 1;
  326. .item {
  327. padding: 0 18rpx;
  328. box-sizing: border-box;
  329. line-height: 40rpx;
  330. height: 40rpx;
  331. text-align: center;
  332. font-size: 20rpx;
  333. font-family: Verdana, Verdana-Regular;
  334. font-weight: 400;
  335. margin-left: 12rpx;
  336. }
  337. }
  338. .shareBtn {
  339. width: 142rpx;
  340. min-width: 142rpx;
  341. height: 52rpx;
  342. border-radius: 8px;
  343. box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.10);
  344. display: flex;
  345. align-items: center;
  346. font-size: 22rpx;
  347. font-family: Verdana, Verdana-Regular;
  348. font-weight: 400;
  349. text-align: left;
  350. color: #ffffff;
  351. white-space: nowrap;
  352. .icon {
  353. width: 32rpx;
  354. height: 32rpx;
  355. margin-left: 10rpx;
  356. }
  357. }
  358. }
  359. .bottomSection {
  360. margin-top: 16rpx;
  361. display: flex;
  362. justify-content: flex-start;
  363. align-items: center;
  364. height: 80rpx;
  365. background: #f8f8f8;
  366. border-radius: 8rpx;
  367. .icon {
  368. width: 20rpx;
  369. height: 28rpx;
  370. margin-right: 14rpx;
  371. margin-left: 25rpx;
  372. }
  373. .name {
  374. font-size: 24rpx;
  375. font-family: Verdana, Verdana-Regular;
  376. font-weight: 400;
  377. text-align: left;
  378. color: #b1b1b1;
  379. }
  380. }
  381. }
  382. .sectionB {
  383. width: 100%;
  384. display: flex;
  385. align-items: center;
  386. padding: 40rpx 36rpx;
  387. box-sizing: border-box;
  388. flex-wrap: wrap;
  389. .item {
  390. width: calc((100% - 12rpx) / 3);
  391. min-width: calc((100% - 12rpx) / 3);
  392. max-width: calc((100% - 12rpx) / 3);
  393. .name {
  394. font-size: 24rpx;
  395. font-family: Verdana, Verdana-Regular;
  396. font-weight: 400;
  397. text-align: left;
  398. color: #b1b1b1;
  399. }
  400. .value {
  401. font-size: 32rpx;
  402. font-family: DIN Alternate, DIN Alternate-Bold;
  403. font-weight: 700;
  404. text-align: left;
  405. white-space: nowrap;
  406. color: #fd8f3c;
  407. }
  408. }
  409. }
  410. .sectionC {
  411. width: 100%;
  412. padding: 0 36rpx 76rpx 36rpx;
  413. box-sizing: border-box;
  414. display: flex;
  415. flex-wrap: wrap;
  416. .title {
  417. font-size: 28rpx;
  418. font-family: Verdana, Verdana-Bold;
  419. font-weight: 700;
  420. text-align: left;
  421. color: #171717;
  422. width: 100%;
  423. margin-bottom: 26rpx;
  424. }
  425. .line {
  426. width: 6rpx;
  427. height: 268rpx;
  428. background: linear-gradient(180deg, #ffd7b9, rgba(255, 215, 185, 0.00));
  429. border-radius: 4rpx;
  430. }
  431. .infos {
  432. margin-left: 30rpx;
  433. width: calc(100% - 36rpx);
  434. margin-top: -20rpx;
  435. display: flex;
  436. flex-wrap: wrap;
  437. align-items: center;
  438. justify-content: space-between;
  439. .item {
  440. width: 50%;
  441. .name {
  442. font-size: 24rpx;
  443. font-family: Verdana, Verdana-Regular;
  444. font-weight: 400;
  445. text-align: left;
  446. color: #b1b1b1;
  447. }
  448. .value {
  449. font-size: 24rpx;
  450. font-family: Verdana, Verdana-Regular;
  451. font-weight: 400;
  452. text-align: left;
  453. color: #262626;
  454. }
  455. }
  456. }
  457. }
  458. .sectionD {
  459. display: flex;
  460. justify-content: space-between;
  461. align-items: center;
  462. margin-left: 30rpx;
  463. width: calc(100% - 60rpx);
  464. height: 140rpx;
  465. background: linear-gradient(108deg, #ffb55f 9%, #f87523 96%);
  466. border-radius: 16rpx;
  467. padding: 0 20rpx 0 26rpx;
  468. box-sizing: border-box;
  469. .icon {
  470. width: 60rpx;
  471. height: 80rpx;
  472. margin-right: 20rpx;
  473. }
  474. .midSection {
  475. flex-grow: 1;
  476. .name {
  477. font-size: 30rpx;
  478. font-family: Verdana, Verdana-Bold;
  479. font-weight: 700;
  480. text-align: left;
  481. color: #ffffff;
  482. }
  483. .value {
  484. font-size: 24rpx;
  485. font-family: Verdana, Verdana-Regular;
  486. font-weight: 400;
  487. text-align: left;
  488. color: #ffead8;
  489. }
  490. }
  491. .invitationBtn {
  492. width: 140rpx;
  493. height: 56rpx;
  494. border-radius: 12rpx;
  495. background-color: #FFFFFF;
  496. font-size: 24rpx;
  497. font-family: Verdana, Verdana-Bold;
  498. font-weight: 700;
  499. text-align: center;
  500. color: #f07423;
  501. line-height: 56rpx;
  502. }
  503. }
  504. }
  505. </style>