|
|
@ -13,13 +13,14 @@ |
|
|
|
<text class="iconfont icon-xiazai5"></text> |
|
|
|
<text class="iconfont icon-xiazai5"></text> |
|
|
|
搜索商品 |
|
|
|
搜索商品 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="qr" @click="startQr()"> |
|
|
|
<!-- #ifndef H5 --> |
|
|
|
|
|
|
|
<view class="qr" @click="startQr()" v-if="$deviceType !== 'weixin'"> |
|
|
|
<image :src="`${$VUE_APP_RESOURCES_URL}/images/qr.png`" /> |
|
|
|
<image :src="`${$VUE_APP_RESOURCES_URL}/images/qr.png`" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- #endif --> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<Banner v-if="item.type == 'banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner> |
|
|
|
<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])" |
|
|
|
<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> |
|
|
|
single="true" :speed="10" showIcon="true" :text="item.componentContent.roll[0].info"></uni-notice-bar> |
|
|
|
|
|
|
|
<view class="content_box home_content_box" v-if="item.type == 'menu' && item.componentContent.menus"> |
|
|
|
<view class="content_box home_content_box" v-if="item.type == 'menu' && item.componentContent.menus"> |
|
|
|
<!-- 菜单 --> |
|
|
|
<!-- 菜单 --> |
|
|
|
<Menu :list="item.componentContent.menus"></Menu> |
|
|
|
<Menu :list="item.componentContent.menus"></Menu> |
|
|
@ -43,50 +44,36 @@ |
|
|
|
<!-- #endif --> |
|
|
|
<!-- #endif --> |
|
|
|
<!-- 为您推荐 --> |
|
|
|
<!-- 为您推荐 --> |
|
|
|
<PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit"></PromotionGood> |
|
|
|
<PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit"></PromotionGood> |
|
|
|
<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> |
|
|
|
</Coupon-window> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import { |
|
|
|
import { mapState, mapMutations, mapActions } from 'vuex' |
|
|
|
mapState, |
|
|
|
import GoodList from '@/components/GoodList' |
|
|
|
mapMutations, |
|
|
|
import PromotionGood from '@/components/PromotionGood' |
|
|
|
mapActions |
|
|
|
import CouponWindow from '@/components/CouponWindow' |
|
|
|
} from "vuex"; |
|
|
|
import Menu from '@/components/Menu' |
|
|
|
import GoodList from "@/components/GoodList"; |
|
|
|
import UniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar' |
|
|
|
import PromotionGood from "@/components/PromotionGood"; |
|
|
|
import Adv from '@/components/sh-adv' |
|
|
|
import CouponWindow from "@/components/CouponWindow"; |
|
|
|
import Groupon from '@/components/sh-groupon.vue' |
|
|
|
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 Banner from './components/Banner' |
|
|
|
import HotCommodity from "./components/HotCommodity"; |
|
|
|
import HotCommodity from './components/HotCommodity' |
|
|
|
import FirstNewProduct from "./components/FirstNewProduct"; |
|
|
|
import FirstNewProduct from './components/FirstNewProduct' |
|
|
|
import ProductsRecommended from "./components/ProductsRecommended"; |
|
|
|
import ProductsRecommended from './components/ProductsRecommended' |
|
|
|
import Live from "./components/Live"; |
|
|
|
import Live from './components/Live' |
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
import { getHomeData, getShare, getCanvas } from '@/api/public' |
|
|
|
getHomeData, |
|
|
|
import cookie from '@/utils/store/cookie' |
|
|
|
getShare, |
|
|
|
import { isWeixin, handleUrlParam } from '@/utils/index' |
|
|
|
getCanvas |
|
|
|
|
|
|
|
} from "@/api/public"; |
|
|
|
|
|
|
|
import cookie from "@/utils/store/cookie"; |
|
|
|
|
|
|
|
import { |
|
|
|
|
|
|
|
isWeixin, |
|
|
|
|
|
|
|
handleUrlParam |
|
|
|
|
|
|
|
} from "@/utils/index"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
import { openShareAll } from '@/libs/wechat' |
|
|
|
openShareAll, |
|
|
|
|
|
|
|
} from '@/libs/wechat' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const HAS_COUPON_WINDOW = "has_coupon_window"; |
|
|
|
const HAS_COUPON_WINDOW = 'has_coupon_window' |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: "Index", |
|
|
|
name: 'Index', |
|
|
|
components: { |
|
|
|
components: { |
|
|
|
// swiper, |
|
|
|
// swiper, |
|
|
|
// swiperSlide, |
|
|
|
// swiperSlide, |
|
|
@ -112,12 +99,12 @@ |
|
|
|
formatMenus: [], |
|
|
|
formatMenus: [], |
|
|
|
categoryCurrent: 0, |
|
|
|
categoryCurrent: 0, |
|
|
|
menuNum: 4, |
|
|
|
menuNum: 4, |
|
|
|
bgcolor: "", |
|
|
|
bgcolor: '', |
|
|
|
bgColor: "", |
|
|
|
bgColor: '', |
|
|
|
swiperCurrent: 0, //轮播下标 |
|
|
|
swiperCurrent: 0, //轮播下标 |
|
|
|
webviewId: 0, |
|
|
|
webviewId: 0, |
|
|
|
showCoupon: false, |
|
|
|
showCoupon: false, |
|
|
|
logoUrl: "", |
|
|
|
logoUrl: '', |
|
|
|
banner: [], |
|
|
|
banner: [], |
|
|
|
menus: [], |
|
|
|
menus: [], |
|
|
|
combinationList: [], |
|
|
|
combinationList: [], |
|
|
@ -139,7 +126,7 @@ |
|
|
|
couponList: [], |
|
|
|
couponList: [], |
|
|
|
swiperOption: { |
|
|
|
swiperOption: { |
|
|
|
pagination: { |
|
|
|
pagination: { |
|
|
|
el: ".swiper-pagination", |
|
|
|
el: '.swiper-pagination', |
|
|
|
clickable: true, |
|
|
|
clickable: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
autoplay: { |
|
|
|
autoplay: { |
|
|
@ -152,7 +139,7 @@ |
|
|
|
observeParents: true, |
|
|
|
observeParents: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
swiperRoll: { |
|
|
|
swiperRoll: { |
|
|
|
direction: "vertical", |
|
|
|
direction: 'vertical', |
|
|
|
autoplay: { |
|
|
|
autoplay: { |
|
|
|
disableOnInteraction: false, |
|
|
|
disableOnInteraction: false, |
|
|
|
delay: 2000, |
|
|
|
delay: 2000, |
|
|
@ -165,13 +152,13 @@ |
|
|
|
swiperScroll: { |
|
|
|
swiperScroll: { |
|
|
|
freeMode: true, |
|
|
|
freeMode: true, |
|
|
|
freeModeMomentum: false, |
|
|
|
freeModeMomentum: false, |
|
|
|
slidesPerView: "auto", |
|
|
|
slidesPerView: 'auto', |
|
|
|
observer: true, |
|
|
|
observer: true, |
|
|
|
observeParents: true, |
|
|
|
observeParents: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
swiperBoutique: { |
|
|
|
swiperBoutique: { |
|
|
|
pagination: { |
|
|
|
pagination: { |
|
|
|
el: ".swiper-pagination", |
|
|
|
el: '.swiper-pagination', |
|
|
|
clickable: true, |
|
|
|
clickable: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
autoplay: { |
|
|
|
autoplay: { |
|
|
@ -186,167 +173,169 @@ |
|
|
|
swiperProducts: { |
|
|
|
swiperProducts: { |
|
|
|
freeMode: true, |
|
|
|
freeMode: true, |
|
|
|
freeModeMomentum: false, |
|
|
|
freeModeMomentum: false, |
|
|
|
slidesPerView: "auto", |
|
|
|
slidesPerView: 'auto', |
|
|
|
observer: true, |
|
|
|
observer: true, |
|
|
|
observeParents: true, |
|
|
|
observeParents: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
bgImage: "", |
|
|
|
bgImage: '', |
|
|
|
}; |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
|
singNew() { |
|
|
|
singNew() { |
|
|
|
return this.roll.length > 0 ? this.roll[0] : "你还没添加通知哦!"; |
|
|
|
return this.roll.length > 0 ? this.roll[0] : '你还没添加通知哦!' |
|
|
|
}, |
|
|
|
}, |
|
|
|
customStyle() { |
|
|
|
customStyle() { |
|
|
|
var bgImage = this.bgImage; |
|
|
|
var bgImage = this.bgImage |
|
|
|
// var style = `height:${this.CustomBar}px;padding-top:${0}px;background: ${this.bgcolor}`; |
|
|
|
// var style = `height:${this.CustomBar}px;padding-top:${0}px;background: ${this.bgcolor}`; |
|
|
|
var style = `height:${this.CustomBar}px;padding-top:${this.StatusBar}px;background: ${this.bgcolor}`; |
|
|
|
var style = `height:${this.CustomBar}px;padding-top:${this.StatusBar}px;background: ${this.bgcolor}` |
|
|
|
if (this.bgImage) { |
|
|
|
if (this.bgImage) { |
|
|
|
style = `${style}background-image:url(${bgImage});`; |
|
|
|
style = `${style}background-image:url(${bgImage});` |
|
|
|
} |
|
|
|
} |
|
|
|
return style; |
|
|
|
return style |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad: function() { |
|
|
|
onLoad: function() { |
|
|
|
this.getLocation(); |
|
|
|
this.getLocation() |
|
|
|
let that = this; |
|
|
|
let that = this |
|
|
|
// uni.showLoading({ |
|
|
|
// uni.showLoading({ |
|
|
|
// title: "加载中", |
|
|
|
// title: "加载中", |
|
|
|
// }); |
|
|
|
// }); |
|
|
|
getCanvas().then(res => {}).catch(error => { |
|
|
|
getCanvas() |
|
|
|
|
|
|
|
.then(res => {}) |
|
|
|
|
|
|
|
.catch(error => { |
|
|
|
this.homeData = JSON.parse(error.data.json) |
|
|
|
this.homeData = JSON.parse(error.data.json) |
|
|
|
console.log(this.homeData) |
|
|
|
console.log(this.homeData) |
|
|
|
console.log(222) |
|
|
|
console.log(222) |
|
|
|
}) |
|
|
|
}) |
|
|
|
getHomeData().then((res) => { |
|
|
|
getHomeData().then(res => { |
|
|
|
that.logoUrl = res.data.logoUrl; |
|
|
|
that.logoUrl = res.data.logoUrl |
|
|
|
res.data.banner.map((item) => (item.bgcolor = item.color || "")); |
|
|
|
res.data.banner.map(item => (item.bgcolor = item.color || '')) |
|
|
|
that.$set(that, "info", res.data.info); |
|
|
|
that.$set(that, 'info', res.data.info) |
|
|
|
that.$set(that, "firstList", res.data.firstList); |
|
|
|
that.$set(that, 'firstList', res.data.firstList) |
|
|
|
that.$set(that, "bastList", res.data.bastList); |
|
|
|
that.$set(that, 'bastList', res.data.bastList) |
|
|
|
that.$set(that, "likeInfo", res.data.likeInfo); |
|
|
|
that.$set(that, 'likeInfo', res.data.likeInfo) |
|
|
|
that.$set(that, "live", res.data.liveList); |
|
|
|
that.$set(that, 'live', res.data.liveList) |
|
|
|
that.$set(that, "lovely", res.data.lovely); |
|
|
|
that.$set(that, 'lovely', res.data.lovely) |
|
|
|
that.$set(that, "benefit", res.data.benefit); |
|
|
|
that.$set(that, 'benefit', res.data.benefit) |
|
|
|
that.$set(that, "couponList", res.data.couponList); |
|
|
|
that.$set(that, 'couponList', res.data.couponList) |
|
|
|
that.$set(that, "combinationList", res.data.combinationList); |
|
|
|
that.$set(that, 'combinationList', res.data.combinationList) |
|
|
|
uni.hideLoading(); |
|
|
|
uni.hideLoading() |
|
|
|
that.setOpenShare(); |
|
|
|
that.setOpenShare() |
|
|
|
// that.doColorThief() |
|
|
|
// that.doColorThief() |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
...mapActions(["getLocation"]), |
|
|
|
...mapActions(['getLocation']), |
|
|
|
onShareTimeline: function() { |
|
|
|
onShareTimeline: function() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
title: this.miniHomeRemark, |
|
|
|
title: this.miniHomeRemark, |
|
|
|
imageUrl: this.miniHomeImg, |
|
|
|
imageUrl: this.miniHomeImg, |
|
|
|
path: "pages/home/index?spread=" + uni.getStorageSync("uid"), |
|
|
|
path: 'pages/home/index?spread=' + uni.getStorageSync('uid'), |
|
|
|
}; |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
onShareAppMessage: function() { |
|
|
|
onShareAppMessage: function() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
title: this.miniHomeRemark, |
|
|
|
title: this.miniHomeRemark, |
|
|
|
imageUrl: this.miniHomeImg, |
|
|
|
imageUrl: this.miniHomeImg, |
|
|
|
path: "pages/home/index?spread=" + uni.getStorageSync("uid"), |
|
|
|
path: 'pages/home/index?spread=' + uni.getStorageSync('uid'), |
|
|
|
}; |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
goRoll(item) { |
|
|
|
goRoll(item) { |
|
|
|
if (item.uniapp_url) { |
|
|
|
if (item.uniapp_url) { |
|
|
|
this.$yrouter.push(item.uniapp_url); |
|
|
|
this.$yrouter.push(item.uniapp_url) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
goGoodSearch() { |
|
|
|
goGoodSearch() { |
|
|
|
// this.$yrouter.push('/pages/shop/GoodsEvaluate/index'); |
|
|
|
// this.$yrouter.push('/pages/shop/GoodsEvaluate/index'); |
|
|
|
this.$yrouter.push("/pages/shop/GoodSearch/index"); |
|
|
|
this.$yrouter.push('/pages/shop/GoodSearch/index') |
|
|
|
}, |
|
|
|
}, |
|
|
|
goWxappUrl(item) { |
|
|
|
goWxappUrl(item) { |
|
|
|
this.$yrouter.push(item.uniapp_url); |
|
|
|
this.$yrouter.push(item.uniapp_url) |
|
|
|
}, |
|
|
|
}, |
|
|
|
goHotNewGoods(type) { |
|
|
|
goHotNewGoods(type) { |
|
|
|
this.$yrouter.push({ |
|
|
|
this.$yrouter.push({ |
|
|
|
path: "/pages/shop/HotNewGoods/index", |
|
|
|
path: '/pages/shop/HotNewGoods/index', |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
type, |
|
|
|
type, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
goGoodsCon(item) { |
|
|
|
goGoodsCon(item) { |
|
|
|
this.$yrouter.push({ |
|
|
|
this.$yrouter.push({ |
|
|
|
path: "/pages/shop/GoodsCon/index", |
|
|
|
path: '/pages/shop/GoodsCon/index', |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
id: item.id, |
|
|
|
id: item.id, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
goGoodsPromotion() { |
|
|
|
goGoodsPromotion() { |
|
|
|
this.$yrouter.push("/pages/shop/GoodsPromotion/index"); |
|
|
|
this.$yrouter.push('/pages/shop/GoodsPromotion/index') |
|
|
|
}, |
|
|
|
}, |
|
|
|
setOpenShare: function() { |
|
|
|
setOpenShare: function() { |
|
|
|
if (this.$deviceType == "weixin") { |
|
|
|
if (this.$deviceType == 'weixin') { |
|
|
|
getShare().then((res) => { |
|
|
|
getShare().then(res => { |
|
|
|
var data = res.data.data; |
|
|
|
var data = res.data.data |
|
|
|
var configAppMessage = { |
|
|
|
var configAppMessage = { |
|
|
|
desc: data.synopsis, |
|
|
|
desc: data.synopsis, |
|
|
|
title: data.title, |
|
|
|
title: data.title, |
|
|
|
link: location.href, |
|
|
|
link: location.href, |
|
|
|
imgUrl: data.img, |
|
|
|
imgUrl: data.img, |
|
|
|
}; |
|
|
|
} |
|
|
|
openShareAll(configAppMessage); |
|
|
|
openShareAll(configAppMessage) |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
startQr: function() { |
|
|
|
startQr: function() { |
|
|
|
uni.scanCode({ |
|
|
|
uni.scanCode({ |
|
|
|
success: (res) => { |
|
|
|
success: res => { |
|
|
|
let option = handleUrlParam(res.result); |
|
|
|
let option = handleUrlParam(res.result) |
|
|
|
switch (option.pageType) { |
|
|
|
switch (option.pageType) { |
|
|
|
case "good": |
|
|
|
case 'good': |
|
|
|
// 跳转商品详情 |
|
|
|
// 跳转商品详情 |
|
|
|
this.$yrouter.push({ |
|
|
|
this.$yrouter.push({ |
|
|
|
path: "/pages/shop/GoodsCon/index", |
|
|
|
path: '/pages/shop/GoodsCon/index', |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
q: res.result, |
|
|
|
q: res.result, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}) |
|
|
|
break; |
|
|
|
break |
|
|
|
case "group": |
|
|
|
case 'group': |
|
|
|
// 跳转团购 |
|
|
|
// 跳转团购 |
|
|
|
this.$yrouter.push({ |
|
|
|
this.$yrouter.push({ |
|
|
|
path: "/pages/activity/GroupRule/index", |
|
|
|
path: '/pages/activity/GroupRule/index', |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
q: res.result, |
|
|
|
q: res.result, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}) |
|
|
|
break; |
|
|
|
break |
|
|
|
case "dargain": |
|
|
|
case 'dargain': |
|
|
|
// 跳转砍价 |
|
|
|
// 跳转砍价 |
|
|
|
this.$yrouter.push({ |
|
|
|
this.$yrouter.push({ |
|
|
|
path: "/pages/activity/DargainDetails/index", |
|
|
|
path: '/pages/activity/DargainDetails/index', |
|
|
|
query: { |
|
|
|
query: { |
|
|
|
q: res.result, |
|
|
|
q: res.result, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}) |
|
|
|
break; |
|
|
|
break |
|
|
|
default: |
|
|
|
default: |
|
|
|
// 跳转分销 |
|
|
|
// 跳转分销 |
|
|
|
this.$yrouter.push({ |
|
|
|
this.$yrouter.push({ |
|
|
|
path: "/pages/Loading/index", |
|
|
|
path: '/pages/Loading/index', |
|
|
|
query: {}, |
|
|
|
query: {}, |
|
|
|
}); |
|
|
|
}) |
|
|
|
break; |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
getbgcolor(e) { |
|
|
|
getbgcolor(e) { |
|
|
|
this.bgcolor = e; |
|
|
|
this.bgcolor = e |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
created: async function() { |
|
|
|
created: async function() { |
|
|
|
// await this.doColorThief(); |
|
|
|
// await this.doColorThief(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
<style scoped lang="less"> |
|
|
|
<style scoped lang="less"> |
|
|
|
.content_box { |
|
|
|
.content_box { |
|
|
@ -439,7 +428,8 @@ |
|
|
|
margin-top: -20rpx; |
|
|
|
margin-top: -20rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.head_box {} |
|
|
|
.head_box { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.nav-title { |
|
|
|
.nav-title { |
|
|
|
margin-left: 20rpx; |
|
|
|
margin-left: 20rpx; |
|
|
|