| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232 |
- <template>
- <view style="background-color: #f2f2f2;">
- <u-navbar :is-back="false" title=" ">
- <view class="slot-wrap">
- <view class="search-wrap" >
- <view style="flex: 30%;" class="flex text-bold padding-right-20 justify-center align-center">
- 周边商城
- </view>
- <view class="">
- <u-search @click="jumpSearch()" disabled :show-action="false" height="56" ></u-search>
- </view>
- </view>
- </view>
- </u-navbar>
- <view :style="{display:show}">
- <!-- <ScrollMenu></ScrollMenu> -->
- <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="heightFix" :src="item.path" @tap="tapNav(item)"></image>
- </swiper-item>
- </swiper>
- <!-- <view style="width: 100%;position: absolute;top: 10rpx;display: flex;justify-content: center;">
- <view style="width: 90%;">
- <u-search @click="jumpSearch()" disabled input-align="center" :show-action="false" placeholder="请输入要搜索的商品" ></u-search>
- </view>
- </view> -->
- </view>
- <!-- 小区信息 -->
- <!-- <view class="head" >
- <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> -->
-
- <view style="padding: 10upx 20upx;background-color: #FFFFFF;" >
- <!-- <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="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 {
- keyword:'',
-
- 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(){
-
- },
- // 判断是否吸顶
- 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) {
- 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) {
- 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>
- .search-wrap {
- margin: 0 20rpx;
- display: flex;
- }
-
- .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: 380upx;
- overflow: hidden;
- .swiper {
- height: 100%;
- width: 100%;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- .ad_banner{
- 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>
|