|
|
|
@ -1,34 +1,14 @@
|
|
|
|
|
<template> |
|
|
|
|
<view class="index"> |
|
|
|
|
<!-- 导航栏 --> |
|
|
|
|
<!-- <view class="head_box " :style="{ background: bgcolor }" :class="{ active: bgcolor }">--> |
|
|
|
|
<!-- <view class="cu-custom" :style="[{height:CustomBar+ 'px',}]">--> |
|
|
|
|
<!-- <view class="cu-bar fixed" :style="customStyle" :class="[bgcolor]">--> |
|
|
|
|
<!-- <view class="action">--> |
|
|
|
|
<!-- <text class="nav-title Shop-selector-rect">{{ 'yshop商城' }}</text>--> |
|
|
|
|
<!-- </view>--> |
|
|
|
|
<!-- <view class="content" :style="[{top:StatusBar + 'px'}]">--> |
|
|
|
|
|
|
|
|
|
<!-- </view>--> |
|
|
|
|
<!-- </view>--> |
|
|
|
|
<!-- </view>--> |
|
|
|
|
<!-- </view>--> |
|
|
|
|
|
|
|
|
|
<view |
|
|
|
|
class="head_box" |
|
|
|
|
:style="{ background: bgcolor }" |
|
|
|
|
:class="{ active: bgcolor }" |
|
|
|
|
> |
|
|
|
|
<view v-for="(item,index) in homeData" :key="index"> |
|
|
|
|
<view class="head_box" v-if="item.type=='header'" :style="{ background: bgcolor }" :class="{ active: bgcolor }"> |
|
|
|
|
<cu-custom :isBack="true" :bgColor="bgcolor"> |
|
|
|
|
<block slot="backText"> |
|
|
|
|
<text class="nav-title shopro-selector-rect">{{ "YSHOP商城" }}</text> |
|
|
|
|
<text class="nav-title shopro-selector-rect">{{ item.componentContent.title }}</text> |
|
|
|
|
</block> |
|
|
|
|
</cu-custom> |
|
|
|
|
</view> |
|
|
|
|
<view |
|
|
|
|
class="header header-search acea-row row-center-wrapper" |
|
|
|
|
:style="{ background: bgcolor }" |
|
|
|
|
> |
|
|
|
|
<view class="header header-search acea-row row-center-wrapper" v-if="item.type=='search'" :style="{ background: bgcolor }"> |
|
|
|
|
<view @click="goGoodSearch()" class="search acea-row row-middle"> |
|
|
|
|
<text class="iconfont icon-xiazai5"></text> |
|
|
|
|
搜索商品 |
|
|
|
@ -37,79 +17,75 @@
|
|
|
|
|
<image src="@/static/images/qr.png" /> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<Banner |
|
|
|
|
:detail="banner" |
|
|
|
|
v-if="banner.length > 0" |
|
|
|
|
@getbgcolor="getbgcolor" |
|
|
|
|
></Banner> |
|
|
|
|
<uni-notice-bar |
|
|
|
|
scrollable="true" |
|
|
|
|
@click="goRoll(singNew)" |
|
|
|
|
single="true" |
|
|
|
|
:speed="10" |
|
|
|
|
showIcon="true" |
|
|
|
|
:text="singNew.info" |
|
|
|
|
></uni-notice-bar> |
|
|
|
|
<Banner v-if="item.type=='banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner> |
|
|
|
|
<uni-notice-bar v-if="item.type=='noticeBar'" scrollable="true" @click="goRoll(item.componentContent.roll[0])" single="true" :speed="10" |
|
|
|
|
showIcon="true" :text="item.componentContent.roll[0].info"></uni-notice-bar> |
|
|
|
|
<view class="content_box home_content_box"> |
|
|
|
|
<!-- 菜单 --> |
|
|
|
|
<Menu :list="menus"></Menu> |
|
|
|
|
<Menu :list="item.componentContent.menus" v-if="item.type=='menu'"></Menu> |
|
|
|
|
<!-- 滚动新闻 --> |
|
|
|
|
<!-- 广告 --> |
|
|
|
|
<Adv /> |
|
|
|
|
<Adv v-if="item.type=='adv'" /> |
|
|
|
|
<!-- 热门榜单 --> |
|
|
|
|
<HotCommodity :detail="likeInfo"></HotCommodity> |
|
|
|
|
<HotCommodity v-if="item.type=='hotCommodity'" :detail="likeInfo"></HotCommodity> |
|
|
|
|
<!-- 超值拼团 --> |
|
|
|
|
<Groupon :detail="combinationList" /> |
|
|
|
|
<Groupon v-if="item.type=='groupon'" :detail="combinationList" /> |
|
|
|
|
<!-- 首发新品->秒杀 --> |
|
|
|
|
<!-- <FirstNewProduct :detail="firstList"></FirstNewProduct> --> |
|
|
|
|
<FirstNewProduct v-if="item.type=='firstNewProduct'" :detail="firstList"></FirstNewProduct> |
|
|
|
|
<!-- 精品推荐 --> |
|
|
|
|
<!-- <ProductsRecommended :detail="bastList"></ProductsRecommended> --> |
|
|
|
|
<!-- 促销单品 |
|
|
|
|
<PromoteProduct :detail="benefit"></PromoteProduct> --> |
|
|
|
|
<ProductsRecommended v-if="item.type=='productsRecommended'" :detail="bastList"></ProductsRecommended> |
|
|
|
|
<!-- 促销单品 --> |
|
|
|
|
<PromoteProduct v-if="item.type=='promoteProduct'" :detail="benefit"></PromoteProduct> |
|
|
|
|
<!-- 直播 --> |
|
|
|
|
<!-- #ifdef MP-WEIXIN --> |
|
|
|
|
<Live :detail="live"></Live> |
|
|
|
|
<Live v-if="item.type=='live'" :detail="live"></Live> |
|
|
|
|
<!-- #endif --> |
|
|
|
|
|
|
|
|
|
<!-- 为您推荐 --> |
|
|
|
|
<PromotionGood :benefit="benefit"></PromotionGood> |
|
|
|
|
<PromotionGood v-if="item.type=='promotionGood'" :benefit="benefit"></PromotionGood> |
|
|
|
|
</view> |
|
|
|
|
<Coupon-window |
|
|
|
|
:coupon-list="couponList" |
|
|
|
|
v-if="showCoupon" |
|
|
|
|
@checked="couponClose" |
|
|
|
|
@close="couponClose" |
|
|
|
|
> |
|
|
|
|
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"> |
|
|
|
|
</Coupon-window> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import { mapState, mapMutations, mapActions } from "vuex"; |
|
|
|
|
import GoodList from "@/components/GoodList"; |
|
|
|
|
import PromotionGood from "@/components/PromotionGood"; |
|
|
|
|
import CouponWindow from "@/components/CouponWindow"; |
|
|
|
|
import Menu from "@/components/Menu"; |
|
|
|
|
import UniNoticeBar from "@/components/uni-notice-bar/uni-notice-bar"; |
|
|
|
|
import Adv from "@/components/sh-adv"; |
|
|
|
|
import Groupon from "@/components/sh-groupon.vue"; |
|
|
|
|
import { |
|
|
|
|
mapState, |
|
|
|
|
mapMutations, |
|
|
|
|
mapActions |
|
|
|
|
} from "vuex"; |
|
|
|
|
import GoodList from "@/components/GoodList"; |
|
|
|
|
import PromotionGood from "@/components/PromotionGood"; |
|
|
|
|
import CouponWindow from "@/components/CouponWindow"; |
|
|
|
|
import Menu from "@/components/Menu"; |
|
|
|
|
import UniNoticeBar from "@/components/uni-notice-bar/uni-notice-bar"; |
|
|
|
|
import Adv from "@/components/sh-adv"; |
|
|
|
|
import Groupon from "@/components/sh-groupon.vue"; |
|
|
|
|
|
|
|
|
|
import Banner from "./components/Banner"; |
|
|
|
|
import HotCommodity from "./components/HotCommodity"; |
|
|
|
|
import FirstNewProduct from "./components/FirstNewProduct"; |
|
|
|
|
import ProductsRecommended from "./components/ProductsRecommended"; |
|
|
|
|
import Live from "./components/Live"; |
|
|
|
|
import Banner from "./components/Banner"; |
|
|
|
|
import HotCommodity from "./components/HotCommodity"; |
|
|
|
|
import FirstNewProduct from "./components/FirstNewProduct"; |
|
|
|
|
import ProductsRecommended from "./components/ProductsRecommended"; |
|
|
|
|
import Live from "./components/Live"; |
|
|
|
|
|
|
|
|
|
import { getHomeData, getShare } from "@/api/public"; |
|
|
|
|
import cookie from "@/utils/store/cookie"; |
|
|
|
|
import { isWeixin, handleUrlParam } from "@/utils/index"; |
|
|
|
|
import { |
|
|
|
|
getHomeData, |
|
|
|
|
getShare, |
|
|
|
|
getCanvas |
|
|
|
|
} from "@/api/public"; |
|
|
|
|
import cookie from "@/utils/store/cookie"; |
|
|
|
|
import { |
|
|
|
|
isWeixin, |
|
|
|
|
handleUrlParam |
|
|
|
|
} from "@/utils/index"; |
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
import { |
|
|
|
|
openShareAll, |
|
|
|
|
} from '@/libs/wechat' |
|
|
|
|
} from '@/libs/wechat' |
|
|
|
|
|
|
|
|
|
const HAS_COUPON_WINDOW = "has_coupon_window"; |
|
|
|
|
const HAS_COUPON_WINDOW = "has_coupon_window"; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
export default { |
|
|
|
|
name: "Index", |
|
|
|
|
components: { |
|
|
|
|
// swiper, |
|
|
|
@ -128,8 +104,9 @@ export default {
|
|
|
|
|
Live, |
|
|
|
|
}, |
|
|
|
|
props: {}, |
|
|
|
|
data: function () { |
|
|
|
|
data: function() { |
|
|
|
|
return { |
|
|
|
|
homeData: [], |
|
|
|
|
CustomBar: this.CustomBar, |
|
|
|
|
StatusBar: this.StatusBar, |
|
|
|
|
formatMenus: [], |
|
|
|
@ -230,18 +207,19 @@ export default {
|
|
|
|
|
return style; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
onLoad: function () { |
|
|
|
|
onLoad: function() { |
|
|
|
|
this.getLocation(); |
|
|
|
|
let that = this; |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: "加载中", |
|
|
|
|
}); |
|
|
|
|
// uni.showLoading({ |
|
|
|
|
// title: "加载中", |
|
|
|
|
// }); |
|
|
|
|
getCanvas().then(res => { |
|
|
|
|
}).catch(error => { |
|
|
|
|
this.homeData = JSON.parse(error.data.json) |
|
|
|
|
}) |
|
|
|
|
getHomeData().then((res) => { |
|
|
|
|
that.logoUrl = res.data.logoUrl; |
|
|
|
|
res.data.banner.map((item) => (item.bgcolor = item.color || "")); |
|
|
|
|
that.$set(that, "banner", res.data.banner); |
|
|
|
|
that.$set(that, "menus", res.data.menus); |
|
|
|
|
that.$set(that, "roll", res.data.roll); |
|
|
|
|
that.$set(that, "info", res.data.info); |
|
|
|
|
that.$set(that, "firstList", res.data.firstList); |
|
|
|
|
that.$set(that, "bastList", res.data.bastList); |
|
|
|
@ -258,14 +236,14 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
...mapActions(["getLocation"]), |
|
|
|
|
onShareTimeline: function () { |
|
|
|
|
onShareTimeline: function() { |
|
|
|
|
return { |
|
|
|
|
title: this.miniHomeRemark, |
|
|
|
|
imageUrl: this.miniHomeImg, |
|
|
|
|
path: "pages/home/index?spread=" + uni.getStorageSync("uid"), |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
onShareAppMessage: function () { |
|
|
|
|
onShareAppMessage: function() { |
|
|
|
|
return { |
|
|
|
|
title: this.miniHomeRemark, |
|
|
|
|
imageUrl: this.miniHomeImg, |
|
|
|
@ -303,7 +281,7 @@ export default {
|
|
|
|
|
goGoodsPromotion() { |
|
|
|
|
this.$yrouter.push("/pages/shop/GoodsPromotion/index"); |
|
|
|
|
}, |
|
|
|
|
setOpenShare: function () { |
|
|
|
|
setOpenShare: function() { |
|
|
|
|
if (this.$deviceType == "weixin") { |
|
|
|
|
getShare().then((res) => { |
|
|
|
|
var data = res.data.data; |
|
|
|
@ -317,7 +295,7 @@ export default {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
startQr: function () { |
|
|
|
|
startQr: function() { |
|
|
|
|
uni.scanCode({ |
|
|
|
|
success: (res) => { |
|
|
|
|
let option = handleUrlParam(res.result); |
|
|
|
@ -364,25 +342,25 @@ export default {
|
|
|
|
|
this.bgcolor = e; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
created: async function () { |
|
|
|
|
created: async function() { |
|
|
|
|
// await this.doColorThief(); |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
<style scoped lang="less"> |
|
|
|
|
.content_box { |
|
|
|
|
.content_box { |
|
|
|
|
background: #f6f6f6; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.index { |
|
|
|
|
.index { |
|
|
|
|
background-color: #fff; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.swiper-item { |
|
|
|
|
.swiper-item { |
|
|
|
|
height: 100%; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.fixed-header { |
|
|
|
|
.fixed-header { |
|
|
|
|
position: fixed; |
|
|
|
|
z-index: 99; |
|
|
|
|
// #ifdef H5 |
|
|
|
@ -397,12 +375,12 @@ export default {
|
|
|
|
|
background: #fff; |
|
|
|
|
box-shadow: 0 0 20rpx -10rpx #aaa; |
|
|
|
|
|
|
|
|
|
& + .fixed-header-box { |
|
|
|
|
&+.fixed-header-box { |
|
|
|
|
height: 98rpx; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.head_box { |
|
|
|
|
.head_box { |
|
|
|
|
width: 750rpx; |
|
|
|
|
// background: #fff; |
|
|
|
|
transition: all linear 0.3s; |
|
|
|
@ -417,17 +395,17 @@ export default {
|
|
|
|
|
font-weight: 500; |
|
|
|
|
color: #fff; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.cu-bar.fixed { |
|
|
|
|
.cu-bar.fixed { |
|
|
|
|
position: fixed; |
|
|
|
|
width: 100%; |
|
|
|
|
top: 0; |
|
|
|
|
z-index: 1024; |
|
|
|
|
// box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.cu-bar { |
|
|
|
|
.cu-bar { |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
|
|
|
|
|
.index .header { |
|
|
|
@ -436,13 +414,13 @@ export default {
|
|
|
|
|
// padding: 0 30rpx; |
|
|
|
|
// box-sizing: border-box; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.header-search { |
|
|
|
|
.header-search { |
|
|
|
|
transition: all linear 0.3s; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.cu-bar .action { |
|
|
|
|
.cu-bar .action { |
|
|
|
|
display: -webkit-box; |
|
|
|
|
display: -webkit-flex; |
|
|
|
|
display: flex; |
|
|
|
@ -454,17 +432,16 @@ export default {
|
|
|
|
|
margin-left: 15px; |
|
|
|
|
font-size: 15px; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.home_content_box { |
|
|
|
|
.home_content_box { |
|
|
|
|
margin-top: -10rpx; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.head_box { |
|
|
|
|
} |
|
|
|
|
.head_box {} |
|
|
|
|
|
|
|
|
|
.nav-title { |
|
|
|
|
.nav-title { |
|
|
|
|
margin-left: 20rpx; |
|
|
|
|
line-height: 40px; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|