houseDetail.vue 13 KB

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