houseDetail.vue 13 KB

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