| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237 |
- <template>
- <view style="background-color: #f2f2f2;">
- <DtCustomBar class="DtCustomBar" title="品质生活" :background="headColor"></DtCustomBar>
- <view :style="{display:show}">
- <view class="head" :style="{background:headColor}">
- <!-- <view class="address">
- <image src="/static/image/address_icon.png"></image>
- <text class="address_text">{{companyAddress}}</text>
- </view> -->
- <view style="display: flex;align-items: center;margin-bottom: 20upx;padding-top: 10rpx;">
- <image src="/static/icon/location.png" style="width: 38upx;height: 38upx;" mode="widthFix"></image>
- <text style="color: #fff;font-size: 30upx;margin-left: 10upx;">{{plotName}}</text>
- </view>
- <view class="search" >
- <!-- <image class="icon" src="/static/image/ic_type.png" mode="" @tap="tapTocategory"></image> -->
- <view class="search_content" @tap="jumpSearch()">
- <image class="search_icon" src="http://139.9.103.171:1888/img/image/search_icon.png" mode="aspectFit"></image>
- <input class="search_input" placeholder="请输入搜索的商品" placeholder-style="color:#ccc;" disabled />
- </view>
- <!-- <view @tap="claimGoods" style="margin-left: 20upx;display: flex;flex-direction: column;justify-content: center;align-items: center;">
- <image class="icon" src="/static/image/ic_yard.png" mode="aspectFit"></image>
- <view style="color: #fff;font-size: 20upx;margin-top: 5upx;">快速取货</view>
- </view> -->
- <!-- <button class="icon_message" type="default" open-type="contact"></button> -->
- </view>
- <ScrollMenu></ScrollMenu>
- </view>
-
- <view style="margin: -110upx 20upx 0;">
- <view class="banner">
- <swiper
- class="swiper"
- interval="5000"
- duration="500"
- autoplay="true"
- circular="true"
- :indicator-dots="adsList.length>1"
- indicator-color="rgba(153,153,153,1)"
- indicator-active-color="#FFF"
- @change="switchColor">
- <swiper-item v-for="(item,index) in adsList" :key="index">
- <image class="image" mode="aspectFill" :src="item.path" @tap="tapNav(item)"></image>
- </swiper-item>
- </swiper>
- </view>
- <view>
- <image class="imgs" v-for="(item,index) in topAds" :key="index" :src="item.path" mode="widthFix" style="width: 100%;display: block;margin-top: 30upx;" @tap="jumpPromotion(item,index)"></image>
- </view>
- <ls-swiper :lists="headNavList" :swiperType="nav" imgKey="imgUrl" :loop="false" :dots="false" :autoplay='false' :height="380" />
- <view style="background-image: linear-gradient(#f2f2f2, #fff);flex:1;position: relative;">
- <!-- <view style="position: absolute;left: 50%;top: 18upx;transform: translateX(-50%);font-size: 32upx;color: #653C00;font-weight: bold;">每日爆款</view> -->
- <view v-if="index==0" v-for="(item,index) in indexProduct" :key="index" @tap="onMore(item)" class="everyDay" :style="{backgroundImage: 'url('+(item.path1?item.path1:'')+')'}">
- <scroll-view scroll-x="true" >
- <view style="display: flex;width: 100%;margin-left: 20upx;">
- <view style="display: flex;">
- <view v-for="(child,idx) in item.products" :key="idx" @tap.stop="jumpGoodsDes(child.id)" style="padding: 6upx 14upx;height: 158upx;border-radius: 20upx;background-color: #fff;margin-right: 8upx;display: flex;flex-direction: column;justify-content: center;align-items: center;">
- <image :src="child.thumbnail" mode="aspectFit" style="width:136upx;height:136upx;"></image>
- <view style="min-width: 76upx;font-size: 28upx;font-weight: bold;color:#fff;text-align: center;border-radius: 25px;background-color: #E42F2F;padding: 0 4upx;">
- <view style="display: inline-block;font-size: 16upx;margin-top: 8upx;">¥</view>{{child.price}}</view>
- </view>
- <view style="width: 12upx;"></view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- <view style="display: flex;border-bottom: 2upx solid #f7f7f7;">
- <view v-if="index==1||index==2" v-for="(item,index) in indexProduct" :key="index" @tap="onMore(item,item.name,index)" style="width: 314upx;padding: 40upx 20upx 20upx;background-color: #fff;border-right: 2upx solid #f7f7f7;">
- <view style="font-size: 28upx;font-weight: bold;">{{item.name}}</view>
- <view style="font-size: 20upx;color:#999999;margin-top: 10upx;">{{item.memo}}</view>
- <scroll-view scroll-x="true">
- <view style="display: flex;width: 100%;">
- <view v-for="(child,idx) in item.products" :key="idx" >
- <image :src="child.thumbnail" style="width:148upx;height:148upx;margin:20upx 0;background-color:#f7f7f7"></image>
- <view style="font-size: 28upx;font-weight: bold;color:#E42F2F;text-align: center;">
- <view style="display: inline-block;font-size: 16upx;margin-top: 8upx;">¥</view>{{child.price}}</view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- <!-- <view style="display: flex;border-bottom: 2upx solid #f7f7f7;">
- <view v-if="index==1||index==2" v-for="(item,index) in indexProduct" :key="index" @tap="onMore(item,item.name,index)" style="width: 360upx;padding: 40upx 20upx 20upx;background-color: #fff;border-right: 2upx solid #f7f7f7;">
- <view style="font-size: 28upx;font-weight: bold;">{{item.name}}</view>
- <view style="font-size: 20upx;color:#999999;margin-top: 10upx;">{{item.memo}}</view>
- <scroll-view scroll-x="true">
- <view style="display: flex;width: 100%;">
- <view v-for="(child,idx) in item.products" :key="idx" >
- <image :src="child.thumbnail" style="width:148upx;height:148upx;margin:20upx 0;background-color:#f7f7f7"></image>
- <view style="font-size: 28upx;font-weight: bold;color:#E42F2F;text-align: center;">
- <view style="display: inline-block;font-size: 16upx;margin-top: 8upx;">¥</view>{{child.price}}</view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view> -->
- <!-- <view>
- <view v-for="(item,index) in centerAd" :key="index" @tap="jumpPromotion(item,index)" style="margin-top: 20upx;">
- <image :src="item.path" mode="widthFix" style="width: 100%;display: block;"></image>
- </view>
- <view style="display: flex;justify-content: space-between;">
- <view v-for="(item,index) in twoAds" :key="index" @tap="jumpPromotion(item,index)" style="flex:1">
- <image :src="item.path" mode="widthFix" style="width: 100%;display: block;"></image>
- </view>
- </view>
- </view> -->
- <view style="display: block;margin-bottom: 20upx;">
- <view v-if="index==3" v-for="(item,index) in indexProduct" :key="index" style="background-color: #fff;padding: 40upx 20upx 25upx;border-bottom-left-radius: 20upx;border-bottom-right-radius: 20upx;">
- <view style="display: flex;justify-content: space-between;">
- <view>
- <view style="font-size: 28upx;font-weight: bold;">{{item.name}}</view>
- <view style="font-size: 20upx;margin-top: 10upx;color: #999;">{{item.memo}}</view>
- </view>
- <view @tap="onMore(item)" style="display: flex;align-items: center;height: 35upx;">
- <view style="font-size: 20upx;">查看更多</view>
- <image src="http://139.9.103.171:1888/img/image/ic_more.png" mode="aspectFit" style="width: 16upx;height: 16upx;margin-left: 5upx;"></image>
- </view>
- </view>
- <scroll-view scroll-x="true">
- <view style="width: 100%;display: flex;">
- <view v-for="(child,idx) in item.products" :key="idx" @tap="jumpGoodsDes(child.id)" style="padding: 0 3upx;height: 232upx;border-radius: 20upx;background-color: #fff;margin-top:20upx;margin-right: 20upx;display: flex;flex-direction: column;justify-content: center;align-items: center;">
- <view :style="idx==0||idx==1?'backgroundColor:#FFE6E6;border-radius:10upx':'backgroundColor:#FFF3E6;border-radius:10upx'" >
- <image :src="child.thumbnail" mode="widthFix" style="width:148upx;height:148upx;display: block;"></image>
- </view>
- <view v-if="idx==0||idx==1" style="min-width: 76upx;font-size: 28upx;font-weight: bold;color:#fff;text-align: center;margin-top: 20upx;border-radius: 25px;background-color: #E42F2F;padding: 0 4upx;">
- <view style="display: inline-block;font-size: 16upx;margin-top: 8upx;">¥</view>{{child.price}}</view>
- <view v-else style="min-width: 76upx;font-size: 28upx;font-weight: bold;color:#fff;text-align: center;margin-top: 20upx;border-radius: 25px;background-color: #FFD062;padding: 0 4upx;">
- <view style="display: inline-block;font-size: 16upx;margin-top: 8upx;">¥</view>{{child.price}}</view>
- </view>
-
- </view>
- </scroll-view>
- </view>
- </view>
- </view>
- <scroll-view id="scrollView" class="menu_scroll" scroll-x="true" :scroll-left="scrollLeft" :style="{top:DtCustomBarHeight+'px'}">
- <view class="menu_type" >
- <view v-for="(item,index) in bottomNavList" :key="index" :class="index==menu_index?'type_item_active':'type_item'" @tap="tapGoodsList(item,index)" >
- <view style="font-weight:bold;position: relative">
- <view
- v-if="index==0||index==1"
- class="bubble bubble-red">自提</view>
- <view
- v-if="index==2||index==3"
- class="bubble bubble-yellow">包邮</view>
- {{item.name}}
- </view>
- <view style="font-size: 20upx;color: #999999;margin-top: 10upx;">{{item.memo}}</view>
- <!-- <view :class="index==menu_index?'type_item_active_line':''"></view> -->
- </view>
- </view>
- </scroll-view>
- <!-- <view :style="isTop==1? 'display: block':'display:none'" class="topHeight"></view> -->
- <swiper :current="menu_index" duration="300" @change="switchTab" :style="{height:product_unit_height}">
- <swiper-item v-for="(item,index) in bottomNavList" :key="index">
- <view class="bottom_goods_list">
- <!-- <DtGoodsListHome :dataList="item.products"/> -->
- <DtGoodsListHome02 :dataList="item.products"/>
- </view>
- </swiper-item>
- </swiper>
-
- <!-- <view class="enIcon">
- <view v-for="(item,idx) in navList" :key="idx" class="item">
- <button v-if="item.funcType == 8" class="customer-service" open-type="contact" session-from="weapp">
- <image :src="item.path"></image>
- <text class="enIcon-btn-text">{{item.name}}</text>
- </button>
- <view class="item2" v-else @tap="tapGoodsList(item)">
- <image :src="item.path"></image>
- <view class="enIcon-text">{{item.name}}</view>
- </view>
- </view>
- </view> -->
- <!-- <view class="ad_banner" v-for="(item,index) in adsList" :key="index">
- <image mode="widthFix" :src="item.path" @tap="tapNav(item)"></image>
- </view> -->
- <!-- <view v-for="(item,idx) in indexProduct" :key="idx">
- <view class="goods_list">
- <DtUnitHead :title="item.name" :memo="item.memo" @more="onMore(item)" />
- <DtGoodsListH :dataList="item.products" :dataItem="item" @more="onMore(item)"/>
- </view>
- </view>
- <view v-for="(item,idx) in navTabsList" :key="idx">
- <view v-if="item.layout==0" class="goods_list">
- <DtUnitHead :title="item.name" :memo="item.memo" @more="onMore(item)" />
- <view class="ad_goods_content">
- <view v-if="cidx==0" class="ad_goods_left" v-for="(citem,cidx) in item.tagGroups" :key="cidx" :style="{backgroundImage: 'url('+(citem.path1?citem.path1:'')+')'}" @tap="onMore(citem)">
- </view>
- <view class="ad_goods_right">
- <view v-if="cidx==1||cidx==2" v-for="(citem,cidx) in item.tagGroups" :key="cidx" class="ad_goods_right_item" :style="{backgroundImage: 'url('+(citem.path1?citem.path1:'')+')'}" @tap="onMore(citem)">
- </view>
- </view>
- </view>
- </view>
- <view v-if="item.layout==1" class="goods_list">
- <DtUnitHead :title="item.name" :memo="item.memo" @more="onMore(item)" />
- <DtGoodsListH v-if="item.tagGroups" :dataList="item.tagGroups" :dataItem="item" @more="onMore(item)"/>
- </view>
- </view> -->
-
- <!-- <view v-if="idx==0" v-for="(item,idx) in indexProduct" :key="idx">
- <view class="goods_list">
- <DtUnitHead :title="item.name" @more="onMore(item)" />
- <view class="ad_goods_content">
- <view v-if="cidx==0" class="ad_goods_left" v-for="(citem,cidx) in item.products" :key="cidx" :style="{backgroundImage: 'url('+citem.thumbnail+')'}" @tap="jumpGoodsDes(citem.id)">
- <view class="ad_goods_name">{{citem.name}}</view>
- <view class="ad_goods_caption">{{citem.caption}}</view>
- <view class="gotosee">去看看</view>
- </view>
- <view class="ad_goods_right">
- <view v-if="cidx==1||cidx==2" v-for="(citem,cidx) in item.products" :key="cidx" class="ad_goods_right_item" :style="{backgroundImage: 'url('+citem.thumbnail+')'}" @tap="jumpGoodsDes(citem.id)">
- <view class="ad_goods_name">{{citem.name}}</view>
- <view class="gotosee">去看看</view>
- </view>
- </view>
- </view>
- </view>
- </view>-->
-
-
- <view v-if="couponList.length>0&&couponShow" class="coupon_mengban">
- <view class="coupon" @tap="tapToCoupon">
- <image src="http://139.9.103.171:1888/img/image/coupon_bg.png" mode="widthFix" style="width: 650upx;height: 680upx;" ></image>
- <image class="ic_off" src="http://139.9.103.171:1888/img/image/ic_coupon_off.png" mode="widthFix" @tap.stop="close_coupon"></image>
- <scroll-view class="scroll" scroll-y="true">
- <view class="coupon_box">
- <!-- @tap="tapDrawCoupon(item,index)" -->
- <view class="coupon_item" v-if="index<2" v-for="(item,index) in couponList" :key="index">
- <image class="coupon_img" src="http://139.9.103.171:1888/img/image/coupon_img_white.png"></image>
- <view class="coupon_info">
- <text class="coupon_unit">¥</text>
- <text class="coupon_amount">{{item.amt}}</text>
- </view>
- <view style="position: absolute;width: 255upx;top: 0;bottom:0;left: 10upx;display: flex;flex-direction: column;justify-content: center;">
- <view class="coupon_name dt-text-row-one">{{item.name}}</view>
- <view class="dt-text-row-one" style="font-size: 16upx;color: #999999;">
- 有效日期:{{item.beginDate}}至{{item.endDate}}
- </view>
- </view>
- </view>
-
- <!-- <view v-if="couponList.length>2" class="coupon_more" @tap="tapToCoupon">
- <view class="more_text">查看更多</view>
- <image src="/static/image/arrow.png"></image>
- </view> -->
- </view>
- </scroll-view>
- </view>
- </view>
- <image
- v-if="couponList.length>0"
- src="http://139.9.103.171:1888/img/image/ic_hongbao.png"
- mode="widthFix"
- @tap="tapToCoupon"
- style="position: fixed;right: 0;bottom: 50upx;width: 150upx;"></image>
- <!-- 商品单元列表 -->
- <!-- <view v-for="(item,idx) in product" :key="idx"
- class="product-unit">
- <DtUnitHead :title="item.name" @more="onMore(item)" />
- <DtGoodsListH :dataList="item.products" />
- <view class="line"></view>
- </view> -->
-
-
- <!-- 微信客服 -->
- <!-- <DtService /> -->
- </view>
- <DtEmpty :type="emptyType" />
- <DtLogin ref="dialogLogin" @signIn="onSignIn" />
- <!-- <view style="display: flex;flex-direction: column;align-items: center;justify-content: center;font-size: 16px;height: 100vh;">
- <view style="font-weight: bold;margin-bottom: 18rpx;">小程序已迁移</view>
- <navigator style="padding: 10rpx 20rpx;background-color: green;border-radius: 6rpx;color: #fff;" target="miniProgram" open-type="navigate" app-id="wx90680ffd54c3b96c" path="/pagesM/pages/home" extra-data="" version="release">点我前往新的小程序</navigator>
- </view> -->
-
- <view style="height: 80rpx;background-color: #F1F1F1;display: flex;justify-content: center;color: #909399;align-items: center;">
- <text>没有更多了</text>
- </view>
- <!-- <view class="text-center margin-top-10" style="font-size: 26rpx;color: #909399;background-color: #FFFFFF;padding: 22rpx;" >
- <text>到底了</text>
- </view> -->
-
- </view>
- </template>
- <script>
- import ScrollMenu from "@/comps/scroll_menu.vue"
- import DtLogin from '@/comps/dt_login.vue'
- import DtEmpty from '@/comps/dt_empty.vue'
- import DtUnitHead from '@/comps/dt_unit_head_v2.vue'
- import DtGoodsListH from '@/comps/dt_goods_list_h.vue'
- import lsSwiper from '@/comps/mosowe-swiper.vue'
- // import DtService from '@/comps/dt_service.vue'
- import DtGoodsListHome from '@/comps/dt_goods_list_home.vue'
- import DtGoodsListHome02 from '@/comps/dt_goods_list_home02.vue'
- import DtCustomBar from '@/comps/dt_custom_bar.vue'
- export default {
- components: {
- DtLogin,
- DtEmpty,
- DtUnitHead,
- // DtService,
- DtGoodsListH,
- lsSwiper,
- DtGoodsListHome,
- ScrollMenu,
- DtCustomBar,
- DtGoodsListHome02
- },
- data() {
- return {
- plotName:'暂无小区信息',
- nav:'nav',
- companyAddress: '',
- adsList: [], //广告动态
- indexProduct:[], // 店铺热卖,店铺推荐....
- couponList: [],
- navList: [], // 导航列表
- memberId: '',
- navTabsList:[],
- menu_index:0, //tab index
- scrollLeft:0,
- isTop:0,
- myScroll:0,
- product_unit_height:1000 + 'px',
- show:'block',
- headNavList:[],
- bottomNavList:[],
- headColor:'#D43A39',
- startSwitchColor:true,
- organizationList:{},
- twoAds:[], //中部会场(两行一列)
- centerAd:[],
- topAds:[], //顶部会场
- DtCustomBarHeight:0,
- couponShow:true
- }
- },
- mounted(){
- // 获得初始距离顶部高度
- this.$nextTick(function(){
- const query = uni.createSelectorQuery().in(this);
- query.select('.DtCustomBar').boundingClientRect(data => {
- this.DtCustomBarHeight = data.height
- }).exec();
- })
- },
- // 判断是否吸顶
- onPageScroll:function(e){
- this.getSwiperHeight();
- // if(e.scrollTop>=this.myScroll){
- // this.isTop = 1;
- // }else{
- // this.isTop = 0;
- // }
-
- const query = uni.createSelectorQuery().in(this);
- query.select('#scrollView').boundingClientRect(data => {
- if(data.top==this.DtCustomBarHeight){
- this.isTop = 1
- }else{
- this.isTop = 0;
- this.myScroll = 0;
- }
- }).exec();
- if(this.isTop==1&&this.myScroll==0){
- this.myScroll = e.scrollTop;
- }
- },
- methods: {
- // 跳转搜索
- jumpSearch(item) {
- console.log(item)
- if (!item) {
- uni.navigateTo({
- url: "/pagesM/pages/search"
- })
- } else {
- let params = {
- keyword: item.name,
- productCategoryId: item.id
- }
- uni.navigateTo({
- url: "/pagesM/pages/search?" + this.$util.serialize(params)
- })
- }
- },
- switchColor(e){
- switch(e.detail.current){
- case 0:this.headColor = '#D43A39';
- break;
- case 1:this.headColor = '#98cb5b';
- break;
- case 2:this.headColor = '#4f85b2';
- }
- },
- claimGoods(){
- uni.navigateTo({
- url: "claim_goods"
- })
- },
-
- openNearbyTeam(){
- uni.navigateTo({
- url: "/pagesM/pages/nearby_team"
- })
- },
- jumpGoodsDes(id) {
- uni.navigateTo({
- url: "/pagesM/pages/goods_des?id=" + id
- })
- },
- //动态设置height
- getSwiperHeight(){
- const query = uni.createSelectorQuery().in(this);
- query.selectAll(".bottom_goods_list").boundingClientRect();
- query.exec((res) => {
- this.product_unit_height =res[0][this.menu_index].height+'px'
- })
- },
- switchTab(e){
- // //判断吸顶之后才返回到滚动起始位置
- if(this.isTop == 1){
- uni.pageScrollTo({
- duration:0,//过渡时间必须为0,uniapp bug,否则运行到手机会报错
- scrollTop:this.myScroll,
- })
- }
- // if(e.detail.current>4){
- // this.scrollLeft = 300
- // }else{
- // this.scrollLeft = 0
- // }
- this.menu_index = e.detail.current
- this.getSwiperHeight();
- },
- tapNav(item){
- let type = item.type; //0:文本广告,1:图片广告 2:会场广告
- if([0,"0"].includes(type)&&item.content){
- uni.navigateTo({
- url: '/pagesM/pages/common/ad_textView?content=' + item.content
- });
- }else if([1,"1"].includes(type)&&item.productId){
- uni.navigateTo({
- url: '/pagesM/pages/goods_des?id=' + item.productId
- });
- }else if([2,'2'].includes(type)&&item.url){
- let url = item.url;
- if (this.memberId){
- url = url + this.memberId;
- console.log('banner 链接 = ' + url)
- uni.navigateTo({
- url: '/pagesM/pages/common/webview?url=' + encodeURIComponent(url)
- });
- }
- }
- },
- jumpPromotion(item,specialType){
- let type = item.type; //0:文本广告,1:图片广告 2:会场广告
- if([0,"0"].includes(type)&&item.content){
- uni.navigateTo({
- url: '/pagesM/pages/common/ad_textView?content=' + item.content
- });
- }else if([1,"1"].includes(type)&&item.productId){
- uni.navigateTo({
- url: '/pagesM/pages/goods_des?id=' + item.productId
- });
- }else if([2,'2'].includes(type)&&item.url){
- // uni.navigateTo({
- // url: "../comps/dt_special?url="+item.url+"&title="+item.title+"&style="+type
- // })
- uni.navigateTo({
- url: "/pagesM/comps/promotion_detail?url="+item.url+"&title="+item.title+"&style="+specialType
- })
- }
-
- },
- tapTocategory(){
- uni.navigateTo({
- url:"/pagseM/pages/category"
- })
- },
- showLogin() {
- this.$refs.dialogLogin.show()
- },
- // 登录成功响应事件
- onSignIn(resp) {
- // console.log(143, resp)
- this.$util.refreshPage(['pages/home', 'pages/shop_car'])
- this.onPullDownRefreshPage()
- },
- onMore(item,name,theme) {
- let params = item.param;
- if(name){
- uni.navigateTo({
- url: "/pagesM/pages/goods_list?params=" + JSON.stringify(params) + '&name=' + name + '&hideTop=true' + '&theme=' + theme + '&path=' + item.path1
- })
- }else{
- uni.navigateTo({
- url: "/pagesM/pages/goods_list?params=" + JSON.stringify(params)
- })
- }
-
- },
-
- close_coupon(){
- this.couponShow = false;
- },
- // 领取优惠券
- async tapDrawCoupon(item, index) {
- // 领取优惠券需要登录
- if (!this.isLogin) {
- this.showLogin()
- return
- }
- console.log('get Voucher', item)
- try {
- let resp = await this.$api.couponExchange({
- _isShowLoading: true,
- _isReject: true,
- memberId: this.memberId,
- couponId: item.id
- })
- if (resp.result) {
- this.$dialog.success('领取成功')
- item.isReceive = true
- this.$set(this.couponList, index, item)
- } else {
- this.$dialog.error('领取失败')
- }
- } catch (err) {
- // if(err.sysflag === '4010' && err.errmsg === '您已经领取过了'){
- // this.$dialog.success('领取成功')
- // item.isReceive = true
- // this.$set(this.couponList, index, item)
- // }else{
- this.$dialog.alert({
- content: err.errmsg || '领取失败'
- })
- // }
- }
- this.close_coupon();
- },
- // 跳转优惠券
- tapToCoupon() {
- uni.navigateTo({
- url: "/pagesM/pages/coupon_center"
- })
- },
- // 商品列表
- tapGoodsList(item,idx) {
- this.menu_index = idx;
- // var list = [];
- // for(let i in this.indexProduct){
- // if(item.name==this.indexProduct[i].name){
- // list.push(this.indexProduct[i]);
- // }
- // }
- // if(this.product.length>0){
- // this.product.splice(0,this.product.length)
- // }
- // if(list){
- // this.product = list.concat()
- // }
-
- // if(item.id == null){
- // if(item.type == "customerService"){
-
- // }
- // }else{
- // // let idx =
- // // console.log(170,item)
- // let params = ''
- // if (item.param) {
- // // console.log(176,[item.param])
- // // params = JSON.stringify([item.param])
- // params = JSON.stringify(item.param);
- // }
- // uni.navigateTo({
- // url: '/pages/goods_list?params=' + params
- // })
- // }
- },
- // async homeNavAds(){
- // let resp = await this.$api.homeNavAds();
- // // this.homeNavAds = resp;
- // return resp
- // },
- //获取公司介绍 地址
- async lookIntroduction() {
- let company = await this.$api.lookIntroduction();
- this.companyAddress = company.intelligence.companyAddress;
- return company
- },
-
- // //查找店铺商品分类
- // async getStoreProductCategorys() {
- // let productCategoryList = await this.$api.getStoreProductCategorys();
- // if(productCategoryList){
- // let plen = productCategoryList.length
- // if(plen<=2 && plen>0){
- // this.getProductChildrenCategorys();
- // }else if(plen > 2){
- // this.tabList = productCategoryList;
- // }else{
- // this.tabList = [];
- // }
- // }else{
- // this.tabList = [];
- // }
- // },
- // // 查找子分类
- // async getProductChildrenCategorys() {
- // let data = {};
- // data.id = this.tabList[0].id;
- // let childrenCategorys = await this.$api.getProductChildrenCategorys(data);
- // this.tabList = childrenCategorys || [];
- // },
- //店铺首页 广告、导航菜单、公司信息
- async storeHomeNavAds() {
- let index = await this.$api.storeHomeNavAds();
- this.adsList = index.carousel;
- this.navList = index.navigation;
- this.twoAds.splice(0,this.twoAds.length);
- index.twoAds.map((item,index)=>{
- if(index!==0){
- this.twoAds.push(item)
- }
- })
- this.centerAd.splice(0,this.centerAd.length);
- this.centerAd.push(index.twoAds[0]);
- this.topAds.splice(0,this.topAds.length);
- this.topAds.push(index.ads[0])
- return index;
- },
- // 获取可兑换优惠券,前端隐藏已领取的优惠券
- async getCouponByStoreId() {
- let resp = await this.$api.getHasExchangeCoupons({
- memberId: this.memberId
- });
- let list = resp || []
- list = list.slice(0, 3)
- if (this.isLogin) {
- list = list.filter((item) => {
- return !item.isReceive
- })
- } else { // 未登录全部显示未领取
- list.map((item) => {
- item.isReceive = false
- return item
- })
- }
- this.couponList = list
- return resp
- },
- async getStoreHomeNavTags(){
- let resp = await this.$api.storeHomeNavTags();
- // this.navTabsList = resp;
- if(resp.length>0){
- this.headNavList.splice(0,this.headNavList.length);
- resp.map((item)=>{
- if(item.name=="中部导航-社区自取"){
- this.headNavList.push(item)
- }
- })
- if(this.headNavList[0].tagGroups.length>9){
- let obj = {}
- let tagGroups = []
- this.headNavList[0].tagGroups.map((item,index)=>{
- if(index>9){
- tagGroups.push(item)
- }
- })
- obj['tagGroups'] = tagGroups
- this.headNavList.push(obj)
- this.headNavList[0].tagGroups.length = 11
- }
- }
- return resp
- },
- //首页产品-店铺热卖-店铺推荐
- async storeHomeProducts() {
- let indexProduct = await this.$api.storeHomeProducts();
- if(indexProduct.length>0){
- this.indexProduct.splice(0,this.indexProduct.length);
- this.bottomNavList.splice(0,this.bottomNavList.length);
- this.indexProduct = indexProduct;
- this.bottomNavList = indexProduct;
- }
-
- return indexProduct
- },
- async touristLogin() {
- // 检查是否登录
- this.isLogin = this.$auth.isAuth
- if (!this.$auth.isAuth) { // 就算是游客,也重新登录
- console.log('需要使用游客身份,执行游客登录!')
- let resp = await this.$api.touristLogin()
- let userType = this.$global.userType.tourist
- this.$auth.login(userType, resp.sessionId, resp.userId, resp)
- console.log('游客登录成功!', resp)
- } else {
- console.log(`已登录!`)
- this.$refs.dialogLogin.hide();
- }
- },
- async getProductCategorys() {
- let resp = await this.$api.getProductCategorys();
- console.log(resp)
- if(resp.length>0){
- this.headNavList.splice(0,this.headNavList.length);
- let obj = {};
- let tagGroups = [];
- resp.map((item,index)=>{
- let childObj = {
- path1:item.icon,
- name:item.name,
- id:item.id
- }
- tagGroups.push(childObj)
- obj['tagGroups'] = tagGroups
-
- })
- this.headNavList.push(obj)
- if(this.headNavList[0].tagGroups.length>10){
- let obj = {}
- let tagGroups = []
- this.headNavList[0].tagGroups.map((item,index)=>{
- if(index>9){
- tagGroups.push(item)
- }
- })
- obj['tagGroups'] = tagGroups
- this.headNavList.push(obj)
- this.headNavList[0].tagGroups.length = 10
- }
- }
- console.log(this.headNavList)
- return resp;
- },
- async loadData() {
- // wx.hideShareMenu();
- this.$dialog.showLoading('加载中...')
- await this.$nextTick(function(){
- this.touristLogin()
- })
- this.memberId = this.$auth.getMemberId();
-
- console.log(this.memberId)
-
- //从缓存中获取小区信息
- this.plotName=uni.getStorageSync("plotName") || '暂无小区信息'
-
- let list = []
- // list.push(this.getOrganizationList());//附近团
- // list.push(this.homeNavAds()); //广告位
- list.push(this.lookIntroduction()); // 获取定位地址
- // list.push(this.getStoreProductCategorys()); // 分类
- list.push(this.getProductCategorys());//产品分类
- list.push(this.storeHomeNavAds()); // 轮播广告导航
- list.push(this.getCouponByStoreId()); // 优惠券
- list.push(this.storeHomeProducts()); // 产品
- // list.push(this.getStoreHomeNavTags()); //店铺首页 导航标签组
- Promise.race(list).then((resList) => {
- console.log(255, resList)
- }).catch(err => {
- consle.log(err)
- }).finally(() => {
- this.emptyType = 0
- if(this.emptyType==0){
- this.show = 'block'
- }else{
- this.show = 'none'
- }
- this.$dialog.hideLoading()
- })
- },
- getParam(e){
- // 用来保存所有的属性名称和值
- let param = "";
- // 开始遍历
- for(let p in e){
- // 方法
- if(typeof(e[p])!="function" && p != 'type'){
- // p 为属性名称,e[p]为对应属性的值
- param += (param.length > 1 ? '&' : '') + p + "=" + e[p];
- }
- }
- // 最后显示所有的属性
- return param;
- },
- execParam(){
- let _this = this;
- if(this.e != null){
- setTimeout(function(){
- if(_this.e == null) return;
- if(_this.e.type == "share"){
- let path = _this.e.path == null || _this.e.path.length <= 0 ? 'pagesM/pages/goods_des' : '/' + _this.e.path;
- let param = _this.getParam(_this.e);
- let url = `${path}?${param}`;
- console.error("url = " + url);
- _this.e = null;
- uni.navigateTo({url: url});
- }
- }, 1000);
- }
- },
- async getOrganizationList(){
- let resp = await this.$api.getOrganizationList({
- _isPull: this.isPull,
- pageNo: 1,
- pageSize: 1
- });
- this.organizationList = resp[0];
- },
- },
- onShow() {
- this.execParam();
- this.onShowPage();
- this.loadData();
- },
- onLoad(e) {
- this.e = e;
- console.log(e)
- //二维码扫描链接 start
- if(e != null && e.q != null){
- let url = decodeURIComponent(e.q);
- let param = {};
- // 把参数按&拆分成数组
- let index = url.indexOf("?");
- let query = url.substring(index+1,index.length);
- var param_arr = query.split("&");
- for (var i = 0; i < param_arr.length; i++) {
- var pair = param_arr[i].split("=");
- param[pair[0]]=pair[1];
- }
- if(param['type'] == "share"){
- let path = 'pagesM/pages/goods_des';
- let params = `id=${param['id']}&storeId=${param['storeId']}&inviteCode=${param['inviteCode']}`
- let url = `${path}?${params}`;
- console.error("url = " + url);
- this.e = null;
- uni.navigateTo({url: url});
- }
- }
- //二维码扫描链接 end
- this.execParam();
- wx.showShareMenu({
- withShareTicket: true
- })
- },
- }
- </script>
- <style lang="scss" scoped>
- .home{
- // background-color: #fff;
- // background-image: url(/static/image/home_bg.jpg);
- // background-size: contain;
- // background-repeat-y: repeat;
- }
- .head {
- padding: 0 20upx;
- // height:300upx;
- height: 250upx;
- border-bottom-left-radius: 10%;
- border-bottom-right-radius: 10%;
- // transition: 0.5s linear all;
- .address {
- display: flex;
- flex-direction: row;
- align-items: center;
- padding: 24upx 0;
- image {
- width: 27upx;
- height: 35upx;
- padding-right: 20upx;
- }
- .address_text {
- flex: 1;
- font-size: 28upx;
- color: #fff;
- letter-spacing: 2upx;
- }
- }
- .search{
- height: 60upx;
- display: flex;
- flex-direction: row;
- align-items: center;
- .icon{
- width: 32upx;
- height: 32upx;
- }
- .icon_message{
- width: 40upx;
- height: 40upx;
- // background-image: url(/static/image/ic_message.png);
- background-size: 100%;
- background-color: transparent;
- }
- .search_content{
- height: 60upx;
- border-radius: 35upx;
- display: flex;
- flex-direction: row;
- align-items: center;
- background: #fff;
- font-size: 24upx;
- flex: 1;
-
- .search_icon {
- width: 24upx;
- height: 24upx;
- margin: 0 30upx;
- }
- .search_input {
- flex: 1;
- height: 60upx;
- }
- }
-
- }
- }
- .banner {
- height: 308upx;
- margin-top: 20upx;
- border-radius: 20upx;
- overflow: hidden;
- .swiper {
- height: 100%;
- width: 100%;
- image {
- border-radius: 20upx;
- width: 100%;
- height: 100%;
- }
- }
- }
- .ad_banner{
- margin: 0 20upx;
- image{
- width: 100%;
- display: block;
- margin-bottom: 34upx;
- }
- }
- .ad_goods_content{
- margin: 0 20upx;
- display: flex;
- .ad_goods_left{
- flex:1;
- height:340upx;
- margin-right: 20upx;
- // background-color:#fff;
- // border-radius:10px;
- position: relative;
- background-repeat: no-repeat;
- background-size: 100% 100%;
- }
- .ad_goods_right{
- flex:1;
- height:340upx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .ad_goods_right_item{
- height:160upx;
- // background-color:#fff;
- // border-radius:10px;
- position: relative;
- background-repeat: no-repeat;
- background-size: 100% 100%;
- }
- }
- .ad_goods_name{
- font-size:36upx;
- font-weight:800;
- color:rgba(51,51,51,1);
- position: absolute;
- top:20upx;
- left:20upx;
- }
- .ad_goods_caption{
- font-size:22upx;
- font-weight:400;
- color:rgba(153,153,153,1);
- margin-top: 10upx;
- position: absolute;
- top:60upx;
- left:20upx;
- }
- .gotosee{
- border-radius: 25upx;
- height:50upx;
- width:100upx;
- font-size: 24upx;
- text-align: center;
- line-height: 50upx;
- background-color: $dt-color-primary;
- position: absolute;
- bottom:20upx;
- left:20upx;
- color:#fff
- }
- }
- .enIcon {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- align-items: center;
- padding: 30upx 0upx;
- .item {
- width: 25%;
- display: flex;
- flex-direction: column;
- align-items: center;
- padding-top: 30upx;
-
- .item2{
- display: flex;
- justify-items: center;
- align-items: center;
- flex-direction: column;
- }
- // 客服按钮
- .customer-service{
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- background-color:transparent;
- border:0;
- }
-
- image {
- width: 80upx;
- height: 80upx;
- // border-radius: 50%;
- }
-
- .enIcon-btn-text{
- font-size: 0.7rem;
- margin-top: 10upx;
- line-height: 40upx;
- color: #353535;
- }
- .enIcon-text {
- margin-top: 10upx;
- font-size: 0.7rem;
- color: #353535;
- }
- }
- }
- .menu_scroll{
- position:sticky;
- z-index:9;
- white-space: nowrap;
- background-color: #f2f2f2;
- width: 100%;
- .menu_type{
- display: flex;
- height:110upx;
- padding-top: 20upx;
- align-items: center;
- .type_item{
- text-align: center;
- flex:1;
- font-size:28upx;
- }
- .type_item_active{
- text-align: center;
- flex:1;
- font-size:28upx;
- color:#DB4444;
- }
- .type_item_active_line{
- width:95upx;
- height:5upx;
- background: $dt-color-primary;
- margin: 0 auto;
- }
- }
- }
- .coupon_mengban{
- transition: all 3s ease;
- position: fixed;
- top: 0;
- bottom: 0;
- right:0;
- left:0;
- background-color: rgba(0,0,0,0.7);
- z-index: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- z-index: 9;
- .coupon {
- width: 650upx;
- position: relative;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .scroll {
- width: 425upx;
- top: 60upx;
- bottom: 250upx;
- position: absolute;
- .coupon_box {
- .coupon_item {
- position: relative;
- height: 120upx;
- margin-bottom: 5upx;
- // padding: 0 15upx;
- .coupon_img {
- width: 420upx;
- height: 120upx;
- }
-
- .coupon_info {
- position: absolute;
- top: 50%;
- right: 0upx;
- text-align: center;
- width: 150upx;
- text-align: center;
- transform: translate(0, -50%);
- color: #d73024;
- font-weight: bold;
- .coupon_amount {
- font-size: 40upx;
- }
-
- .coupon_unit {
- font-size: 20upx;
- }
- }
-
- .coupon_name {
- color: #d73024;
- font-size: 30upx;
- font-weight: bold;
- margin-bottom: 20upx;
- }
- }
-
- .coupon_more {
- display: flex;
- flex-direction: row;
- align-items: center;
- padding: 0 30upx;
-
- .more_text {
- font-size: 22upx;
- color: #999;
- width: 60upx;
- text-align: center;
- margin-right: 10upx;
- }
-
- image {
- width: 10upx;
- height: 18upx;
- }
- }
- }
- }
- .ic_off{
- width: 50upx;
- height: 50upx;
- position: absolute;
- bottom: -100upx;
- z-index:10
- }
- }
- }
- .line {
- width: 100%;
- height: 20upx;
- background: #f2f2f2;
- }
- .everyDay{
- height:210upx;
- border-radius: 20upx;
- background-repeat: no-repeat;
- background-size: 100% 100%;
- padding-top: 80upx;
- }
- .bubble{
- position: absolute;
- top: -28upx;
- right: 20upx;
- width: 50upx;
- height: 28upx;
- background-size: 100% 100%;
- background-repeat: no-repeat;
- color: #fff;
- font-size: 16upx;
- text-align: center;
- line-height: 28upx;
- float: right;
- }
- .bubble-red{
- background-image: url("http://139.9.103.171:1888/img/image/bubble_red.png");
- }
- .bubble-yellow{
- background-image: url("http://139.9.103.171:1888/img/image/bubble_yellow.png");
- }
- </style>
|