hxj_index_component.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. <template>
  2. <view style="background-color: #FEFFFE;">
  3. <view class="swiper_cent">
  4. <swiper style="height: 900rpx;" :indicator-dots="false" :autoplay="false" :interval="3000" :duration="1000"
  5. @change="swiperChange">
  6. <swiper-item v-for="(item,index) in homePages[0].data.banners" :key="index" @click="goPage(item.url)">
  7. <image :src="item.picUrl" style="width: 100%;height: 900rpx;" mode=""></image>
  8. </swiper-item>
  9. </swiper>
  10. <view class="swiper_zhishi">
  11. <view :class="swiperKey===i?'view_active':''" v-for="(item1,i) in homePages[0].data.banners.length" :key="i"></view>
  12. </view>
  13. </view>
  14. <u-announcement
  15. v-bind:bgColor="homePages[1].data.background"
  16. v-bind:btn-color="homePages[1].data.btnColor"
  17. v-bind:btn-height="homePages[1].data.btnHeight"
  18. v-bind:btn-radius="`${homePages[1].data.btnRadius}rpx`"
  19. v-bind:btn-text="homePages[1].data.btnText"
  20. v-bind:btn-text-color="homePages[1].data.btnTextColor"
  21. v-bind:btn-width="homePages[1].data.btnWidth"
  22. v-bind:content="homePages[1].data.content"
  23. v-bind:header-url="homePages[1].data.headerUrl"
  24. v-bind:icon="homePages[1].data.icon"
  25. v-bind:name="homePages[1].data.name"
  26. v-bind:textColor="homePages[1].data.textColor"
  27. ></u-announcement>
  28. <view class="link">
  29. <view>
  30. <view class="title">人居 · 荟享家<image class="hxjImg"
  31. src="https://t17.9026.com/web/statics/image/index/HUIXIANGJIA.png" mode=""></image>
  32. </view>
  33. </view>
  34. </view>
  35. <app-scroll-list :list="list"></app-scroll-list>
  36. <view class="link">
  37. <view class="title1">本期家点灵感</view>
  38. <image class="tyx" src="https://t17.9026.com/web/statics/image/index/tyx.png" mode=""></image>
  39. <image class="d6" src="https://t17.9026.com/web/statics/image/index/6d.png" mode=""></image>
  40. <view class="subtitle">臻选整装 · 安全无甲醛 · 7天入住</view>
  41. </view>
  42. <view class="lg_list">
  43. <view class="item" v-for="(item,index) in compositionList" :key="index"
  44. @click="goPage(item.type=='goods'?`/pages/goods/goods?id=${item.id}`:`/pages/case/projectInfo?id=${item.id}`)">
  45. <image class="imgBox" :src="item.cover_img">
  46. </image>
  47. <view class="b_card main-between">
  48. <view class="left">
  49. <view class="title t-omit" style="width: 420rpx;">{{item.name}}</view>
  50. <view class="desc t-omit" style="width: 420rpx;">{{item.tag}}</view>
  51. </view>
  52. <view class="right">
  53. <view class="price"><text class="rmb">¥</text><text>{{item.price}}</text><text
  54. class="dw">元</text></view>
  55. </view>
  56. </view>
  57. </view>
  58. <!-- <view class="more">
  59. <view>VIEW MORE</view>
  60. <view>
  61. <image src="https://t17.9026.com/web/statics/image/index/viewmore.png" mode=""></image>
  62. </view>
  63. </view> -->
  64. </view>
  65. <view class="link ">
  66. <view class="title1 main-left cross-center">优惠券<image class="coupon_1"
  67. src="https://t17.9026.com/web/statics/image/index/coupon_1.png" mode=""></image><text
  68. class="coupon_sub">RECOMMEND</text></view>
  69. </view>
  70. <view class="coupon main-left">
  71. <view class="item main-left" v-for="(item,index) in homePages[6].data.coupon_list" :key="index" @click="receive(index)">
  72. <view class="Wb">
  73. <view>
  74. <view class="title_2">定制优享礼券 <text class="hjx-tc-B19D60 hjx-ts-21 hxj-ml-10">立即领取</text></view>
  75. <view class="desc_2">新用户礼遇</view>
  76. </view>
  77. <view>
  78. <view class="price"><text>¥</text>{{item.sub_price}}</view>
  79. <view class="yxq">有效期至{{item.end_time.split(' ')[0]}}</view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="link mt_20">
  85. <view class="title1">荟享定制<image class="coupon_1"
  86. src="https://t17.9026.com/web/statics/image/index/coupon_1.png" mode="">
  87. </image><text class="coupon_sub">HUIXIANG</text></view>
  88. </view>
  89. <view class="hxdz">
  90. <view class="main-left q">
  91. <view class="l" @click="goPage(homePages[7].data.list[0].link.new_link_url)">
  92. <view class="title_2">明星套装</view>
  93. <view class="desc_2">自然高端好家居</view>
  94. <image :src="homePages[7].data.list[0].pic_url" mode=""></image>
  95. </view>
  96. <view class="main-between-y">
  97. <view class="r1" @click="goPage(homePages[7].data.list[1].link.new_link_url)">
  98. <view class="title_2">优选</view>
  99. <view class="desc_2">优选家居</view>
  100. <image :src="homePages[7].data.list[1].pic_url" mode=""></image>
  101. </view>
  102. <view class="r2" @click="goPage(homePages[7].data.list[2].link.new_link_url)">
  103. <view class="title_2">专属</view>
  104. <view class="desc_2">定制精品</view>
  105. <image :src="homePages[7].data.list[2].pic_url" mode=""></image>
  106. </view>
  107. </view>
  108. </view>
  109. <scroll-view scroll-x="true">
  110. <view class="main-left w">
  111. <view class="item" v-for="(item,index) in homePages[8].data.navs" :key="index">
  112. <image class="borradu_20"
  113. :src="item.icon_url"
  114. mode=""></image>
  115. <view class="title_2">{{item.name}}</view>
  116. <view class="desc_2">独到品味的代表备份</view>
  117. </view>
  118. </view>
  119. </scroll-view>
  120. <!-- <view class="more">
  121. <view class="viewmore1_color">查看更多</view>
  122. <view class="viewmore1_color">VIEW MORE</view>
  123. <view>
  124. <image class="viewmore1" src="https://t17.9026.com/web/statics/image/index/viewmore1.png" mode=""></image>
  125. </view>
  126. </view> -->
  127. </view>
  128. <view class="main-between link mt_20">
  129. <view class="title1">
  130. 限时团购
  131. <image class="coupon_1" src="https://t17.9026.com/web/statics/image/index/coupon_1.png" mode="">
  132. </image>
  133. <text class="coupon_sub">TUANGOU</text>
  134. </view>
  135. <view class="link-more" @click="goPage('/plugins/pt/index/index')">
  136. 查看更多<image src="https://t17.9026.com/web/statics/image/index/arrow-right-gray.png" mode=""></image>
  137. </view>
  138. </view>
  139. <view class="group_list">
  140. <swiper style="height: 606rpx;" :indicator-dots="false" :autoplay="false" :interval="3000" :duration="1000"
  141. previous-margin="25rpx" next-margin="25rpx" :current="ptCurrent" @change="ptChange">
  142. <swiper-item class="" v-for="(item,index) in homePages[9].data.list" :key="index"
  143. @click="goPage(item.page_url)">
  144. <view class="item">
  145. <view class="imgBox" >
  146. <image class="img" :src="item.cover_pic"></image>
  147. </view>
  148. <view class="b_card main-between" >
  149. <view class="main-left cross-center left">
  150. <view class="i">{{item.pintuanGoods.time_str.day}}</view>
  151. <view class="q">:</view>
  152. <view class="i">{{item.pintuanGoods.time_str.hou}}</view>
  153. <view class="q">:</view>
  154. <view class="i">{{item.pintuanGoods.time_str.min}}</view>
  155. <view class="q">:</view>
  156. <view class="i">{{item.pintuanGoods.time_str.sec}}</view>
  157. </view>
  158. <view class="right">
  159. <view class="price"><text class="rmb">¥</text><text>{{item.pintuan_price}}</text><text
  160. class="dw">元</text></view>
  161. </view>
  162. </view>
  163. </view>
  164. </swiper-item>
  165. </swiper>
  166. </view>
  167. <view class="link main-left">
  168. <!-- <view class="title1" style="margin-right: 61rpx;">荟享自营</view>
  169. <view class="title1" style="margin-right: 61rpx;color: #A7A7A7;">精选类别</view>
  170. <view class="title1" style="margin-right: 61rpx;color: #A7A7A7;">精选类别</view>
  171. <view class="title1" style="margin-right: 61rpx;color: #A7A7A7;">精选类别</view> -->
  172. <view class="title1" style="margin-right: 61rpx;" :style="{'color':bottom_goods_index===index?'':'#A7A7A7'}" v-for="(item,index) in homePages[11].data.catList" :key="index" @click="selectCat(index)">{{item.menuName}}</view>
  173. <image class="tyx" src="https://t17.9026.com/web/statics/image/index/tyx.png" mode=""></image>
  174. </view>
  175. <view class="hxzy">
  176. <view class="top">
  177. <image
  178. style="width: 560rpx;height: 270rpx;border-radius: 20rpx 0 0 0;position: absolute;top: 0;right: 0;"
  179. src="https://t17.9026.com/web/statics/image/index/9.png" mode=""></image>
  180. <view class="dbo main-between-y">
  181. <view>
  182. <view class="text">decoration荟享自营</view>
  183. <view class="text">心至所向·渐入家境</view>
  184. </view>
  185. <!-- <view class="category">2930人已收藏</view> -->
  186. </view>
  187. </view>
  188. <view class="dir-left-wrap bottom">
  189. <view class="item" v-for="(item,index) in homePages[11].data.catList[bottom_goods_index].goodsList" :key="index"
  190. @click="goPage(`/pages/goods/goods?id=${item.id}`)">
  191. <view>
  192. <image class="cover" :src="item.cover_pic"
  193. mode=""></image>
  194. </view>
  195. <view class="title_2 t-omit" style="width: 320rpx;">{{item.name}}</view>
  196. <view class="desc_2">{{item.sales}}</view>
  197. <view class="price" style="margin-top: 27rpx;"><text class="rmb">¥</text><text>{{item.price}}</text><text
  198. class="dw">元</text></view>
  199. </view>
  200. </view>
  201. <view class="more1" @click="goPage('/pages/cats/cats')">
  202. <view class="viewmore1_color main-center cross-center">更多荟享<image class=""
  203. src="https://t17.9026.com/web/statics/image/index/viewmore1.png" mode=""></image>
  204. </view>
  205. </view>
  206. </view>
  207. <view class="bottom_logo">
  208. <image src="https://t17.9026.com/web/statics/image/index/bottom_logo.png" mode=""></image>
  209. <view class="text">home shopping mall</view>
  210. </view>
  211. </view>
  212. </template>
  213. <script>
  214. import {mapState} from 'vuex'
  215. import appScrollList from './components/scroll-list.vue'
  216. import uAnnouncement from "@/components/page-component/u-announcement/u-announcement.vue";
  217. export default {
  218. components: {
  219. appScrollList,
  220. uAnnouncement
  221. },
  222. props: {
  223. homePagesProps: {
  224. type: Object,
  225. default () {
  226. return {
  227. navs: [],
  228. };
  229. },
  230. },
  231. page_id:{
  232. type:Number,
  233. default:0
  234. },
  235. dIndex: {
  236. type: Array,
  237. default () {
  238. return [0, 0];
  239. }
  240. },
  241. mIndex: {
  242. type: Array,
  243. default () {
  244. return [0, 0];
  245. }
  246. },
  247. dType:String
  248. },
  249. computed:{
  250. ...mapState({
  251. selectedProperties:state=>state.user.selectedProperties
  252. })
  253. },
  254. watch:{
  255. selectedProperties(){
  256. this.getComposition()
  257. },
  258. homePagesProps:{
  259. handler:function(nVal,oVal){
  260. this.homePages=nVal;
  261. this.countdown(nVal[9].data.list)
  262. },
  263. deep:true
  264. }
  265. },
  266. data() {
  267. return {
  268. ptCurrent:1,//拼图轮播第几个
  269. pageData: '',
  270. swiperKey: 0, //轮播位置
  271. bottom_goods_index:0, //底部商品分类索引
  272. homePages:null,
  273. list: [
  274. {
  275. image: 'https://t17.9026.com/web/statics/image/index/temporary/jhk-1634283687206.png',
  276. title: '热销方案',
  277. tag: '热销',
  278. link: '/pages/case/hot_sale_project'
  279. },
  280. {
  281. image: 'https://t17.9026.com/web/statics/image/index/temporary/jhk-1634284372084.png',
  282. title: '主题专区',
  283. tag: '主题',
  284. // link: '/pages/case/themeArea'
  285. link:'/pages/topic/list'
  286. },
  287. {
  288. image: 'https://t17.9026.com/web/statics/image/index/temporary/jhk-1634283667210.png',
  289. title: '定制产品',
  290. tag: '预约',
  291. link: '/pages/case/appointment/appointment-list'
  292. },
  293. {
  294. image: 'https://t17.9026.com/web/statics/image/index/2.png',
  295. title: '明星套装',
  296. tag: '套装',
  297. link: '/pages/case/appointment/appointment-list'
  298. }
  299. ],
  300. // jdlg: [{
  301. // title: '兴城人居ins风套装',
  302. // sub_title: '细节控·轻奢风',
  303. // price: '65622',
  304. // cover_image: '3',
  305. // },
  306. // {
  307. // title: '风创造「最大坪效」85m²MUJI',
  308. // sub_title: '细节控·轻奢风',
  309. // price: '7486',
  310. // cover_image: 'temporary/jhk-1634283447190'
  311. // },
  312. // {
  313. // title: '85m²MUJI风创造「最大坪效」',
  314. // sub_title: '细节控·轻奢风',
  315. // price: '27853',
  316. // cover_image: 'temporary/jhk-1634284367308'
  317. // }
  318. // ],
  319. // qwe: [
  320. // {
  321. // 'title': '兴城人居',
  322. // 'cover_image': 'jhk-1634283667210'
  323. // }, {
  324. // 'title': '世龙广场',
  325. // 'cover_image': 'jhk-1634284372084'
  326. // }, {
  327. // 'title': '新中式',
  328. // 'cover_image': 'jhk-1634283687206'
  329. // },
  330. // ],
  331. compositionList:[],//本期家点灵感
  332. // 倒计时
  333. // time_str: {
  334. // day: '00',
  335. // hou: '00',
  336. // min: '00',
  337. // sec: '00'
  338. // },
  339. down_time: 0,
  340. }
  341. },
  342. created() {
  343. this.getComposition()
  344. },
  345. methods: {
  346. selectCat(index){
  347. this.bottom_goods_index=index
  348. },
  349. swiperChange(e) {
  350. console.log(e.detail.current)
  351. this.swiperKey = e.detail.current
  352. },
  353. goPage(url) {
  354. uni.navigateTo({
  355. url: url
  356. })
  357. },
  358. //获取推荐套餐
  359. getComposition(){
  360. this.$request({
  361. url:this.$api.composition.list,
  362. data:{
  363. is_recommend:1,
  364. limit:3
  365. },
  366. method:'post'
  367. }).then(res=>{
  368. if(res.code===0){
  369. this.compositionList=res.data.list
  370. }
  371. })
  372. },
  373. //领取优惠券
  374. receive(index) {
  375. let list = this.homePages[6].data.coupon_list
  376. if (this.sign == 'integral-mall') {
  377. this.$jump({
  378. url: list[index].page_url,
  379. open_type: 'navigate'
  380. });
  381. return;
  382. }
  383. if (list[index].is_receive == 1) {
  384. uni.showToast({
  385. mask: true,
  386. title: '已领取',
  387. icon: 'none'
  388. });
  389. return true;
  390. }
  391. uni.showLoading({
  392. mask: true,
  393. title: '领取中'
  394. });
  395. this.$request({
  396. url: this.$api.coupon.receive,
  397. data: {
  398. coupon_id: list[index].id
  399. }
  400. }).then(e => {
  401. uni.hideLoading();
  402. if (e.code === 0) {
  403. if (e.data.rest == 0) {
  404. this.homePages[6].data.coupon_list[index].is_receive = '1';
  405. }
  406. let tempList = this.homePages[6].data.coupon_list;
  407. this.flushCache(tempList);
  408. this.$store.dispatch('page/actionSetCoupon', {
  409. list: [Object.assign(tempList[index], e.data)],
  410. type: 'receive'
  411. });
  412. } else {
  413. uni.showToast({
  414. title: e.msg,
  415. icon: 'none'
  416. });
  417. }
  418. }).catch(() => {
  419. uni.hideLoading();
  420. });
  421. },
  422. flushCache(coupon_list) {
  423. if (this.page_id == 0) {
  424. let storage = this.$storage.getStorageSync('INDEX_MALL');
  425. let dIndex = this.dIndex;
  426. let mIndex = this.mIndex;
  427. if (this.dType === 'module') {
  428. storage.home_pages.navs[mIndex[0]].template.data[mIndex[1]].data.list[dIndex[0]].data[dIndex[1]]
  429. .data.coupon_list = coupon_list;
  430. } else {
  431. storage.home_pages.navs[dIndex[0]].template.data[dIndex[1]].data.coupon_list = coupon_list;
  432. }
  433. this.$storage.setStorageSync('INDEX_MALL', storage);
  434. }
  435. },
  436. ptChange(e){
  437. this.ptCurrent=e.detail.current
  438. },
  439. countdown(list) {
  440. for (let i = 0; i < list.length; i++) {
  441. let item=list[i].pintuanGoods.end_time
  442. let time = new Date(item.replace(/-/g, '/'));
  443. let nowTime = new Date();
  444. let equation = time.getTime() - nowTime.getTime();
  445. let day = parseInt((equation / 3600000 / 24));
  446. let hour = parseInt((equation / 1000 / 60 / 60) % 24);
  447. let minute = parseInt((equation / 1000 / 60) % 60);
  448. let second = parseInt((equation / 1000) % 60);
  449. this.homePages[9].data.list[i].pintuanGoods.time_str = {
  450. day: day < 10 ? `0${day}` : day,
  451. hou: hour < 10 ? `0${hour}` : hour,
  452. min: minute < 10 ? `0${minute}` : minute,
  453. sec: second < 10 ? `0${second}` : second
  454. }
  455. }
  456. this.down_time = setTimeout(() => {
  457. this.countdown(list);
  458. }, 1000);
  459. },
  460. },
  461. deactivated() {
  462. clearTimeout(this.down_time)
  463. }
  464. }
  465. </script>
  466. <style lang="scss" scoped>
  467. @import './index.scss';
  468. .swiper_cent {
  469. position: relative;
  470. .swiper_zhishi {
  471. display: flex;
  472. align-items: center;
  473. width: 100%;
  474. justify-content: center;
  475. position: absolute;
  476. bottom: 39rpx;
  477. view {
  478. width: 81rpx;
  479. height: 4rpx;
  480. background: #c8c8c8;
  481. }
  482. .view_active {
  483. background: #f4f4f4;
  484. }
  485. }
  486. }
  487. .ptcc{
  488. animation:myfirst 0.5s infinite;
  489. animation-iteration-count:1;
  490. animation-fill-mode:forwards;
  491. }
  492. // .ptee{
  493. // animation:myfirst 0.5s infinite;
  494. // animation-iteration-count:1;
  495. // animation-fill-mode:forwards;
  496. // animation-direction:reverse;
  497. // }
  498. @keyframes myfirst
  499. {
  500. from {height: 404rpx;}
  501. to {margin-top: 40rpx;height: 365rpx!important;}
  502. }
  503. </style>