| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457 |
- <template>
- <view class="center">
- <!-- 顶部logo and 搜索 start-->
- <view class="status_bar"></view>
- <view class="top-search flex">
- <view class="search-box flex" @click="navto('/pages/columnGoods/goods_search/index')">
- <image class="search" src="../../static/icon/search-h.png" mode=""></image>
- <view class="search-font">输入关键词搜索</view>
- </view>
- </view>
- <!-- 顶部logo and 搜索 end-->
- <view class="jg"></view>
- <!-- 轮播图 start -->
- <view class="swiper-wrap">
- <swiper class="top-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
- <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
- @click="bannerNavToUrl(item)">
- <image :src="item.img" />
- </swiper-item>
- </swiper>
- </view>
- <!-- 轮播图 end -->
- <view class="jg"></view>
- <!-- 分类 start-->
- <view class="cate-section flex">
- <view class="cate-item flex" @click="goCp()">
- <view class="img-wrapper flex">
- <image src="../../static/icon/c2.png" mode=""></image>
- </view>
- <view class="item-title">环球国际</view>
- </view>
- <view class="cate-item flex" @click="gozx">
- <view class="img-wrapper flex">
- <image src="../../static/icon/c1.png" mode=""></image>
- </view>
- <view class="item-title">易博甄选</view>
- </view>
- <view class="cate-item flex" @click="openGg()" v-if="isAndroid">
- <view class="img-wrapper flex">
- <image src="../../static/icon/c3.png" mode=""></image>
- </view>
- <view class="item-title">视频领奖</view>
- </view>
- <view class="cate-item flex" @click="navto('/pages/store/shopStreet/index')">
- <view class="img-wrapper flex">
- <image src="../../static/icon/c4.png" mode=""></image>
- </view>
- <view class="item-title">商铺列表</view>
- </view>
- <view class="cate-item flex" @click="nav('/pages/user/shareQrCode')">
- <view class="img-wrapper flex">
- <image src="../../static/icon/c5.png" mode=""></image>
- </view>
- <view class="item-title">邀请有礼</view>
- </view>
- </view>
- <!-- 分类 end-->
- <!-- 专区 start -->
- <view class="sbkh-wrap">
- <image src="../../static/img/sbkh.jpg" mode=""></image>
- <view class="sbkh-xfzq" @click.stop="navto('/pages/index/xfqzq')">
- </view>
- <view class="sbkh-jfzq" @click="navto('/pages/index/bdzq')">
- </view>
- </view>
- <!-- 魔方 -->
- <!-- <view class="zq-wrap flex">
- <view class="zq-item" @click="nav('/pages/index/xfqzq')">
- <view class="zq-tit">
- 消费券专区
- </view>
- <view class="item-info flex">
- <image src="../../static/img/xf-bg.png" mode=""></image>
- <view class="info-tit">
- <image src="../../static/icon/ms.png" mode="widthFix"></image>
- </view>
- </view>
- </view>
- <view class="zq-item bd" @click="nav('/pages/index/bdzq')">
- <view class="zq-tit">
- 积分专区
- </view>
- <view class="item-info flex">
- <image src="../../static/img/bd-bg.png" mode=""></image>
- <view class="info-tit">
- <image src="../../static/icon/bd.png" mode="widthFix"></image>
- </view>
- </view>
- </view>
- </view> -->
- <!-- 专区 end -->
- <!-- 商品列表 start -->
- <view class="product-box">
- <view class="product-tit flex">
- <view class="hx">
- </view>
- <view class="tit">
- 猜您喜欢
- </view>
- <view class="hx">
- </view>
- </view>
- <view class="hotgoods">
- <view class="hotgoods-item" v-for="item in sortProduct" :key="item.id"
- @click="navto('/pages/goods_details/index?id=' + item.product_id)" style="height: 520rpx;">
- <view class="image-wrapper">
- <image class="image" :src="item.image" mode="scaleToFill"></image>
- </view>
- <view class="flex"
- style="flex-direction: column;justify-content: space-between;align-items: flex-start;height: 160rpx;">
- <view class="title clamp2">{{item.store_info}}</view>
- <view class="hot-price">
- <view class="price">
- <text class="font-size-sm"></text>
- {{ item.price * 1 }}<text class="jf">积分</text>
- </view>
- <view class="yuanPrice">市场价:¥{{ item.ot_price*1 }}</view>
- </view>
- </view>
- </view>
- </view>
- <!-- <uni-load-more :status="loadingType"></uni-load-more> -->
- </view>
- <view class="page-btm" style="padding-top: 20rpx;">
- ©2022 浙江易博网络科技有限公司 版权所有
- </view>
- <view class="page-btm" @click="gocx" style="padding-bottom: 10rpx;">
- 浙ICP备2021013190号-9
- </view>
- </view>
- </template>
- <script>
- var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
- let app = getApp();
- import {
- getUserInfo
- } from '@/api/user.js';
- import {
- getDiy,
- getIndexData,
- getAppVersion,
- getUserCoupons
- } from '@/api/api.js';
- // #ifdef MP-WEIXIN
- import {
- getTemlIds
- } from '@/api/api.js';
- import {
- SUBSCRIBE_MESSAGE,
- TIPS_KEY
- } from '@/config/cache';
- // #endif
- import {
- getShare,
- getconfig
- } from '@/api/public.js';
- import {
- goShopDetail
- } from '@/libs/order.js';
- import {
- mapGetters
- } from 'vuex';
- import {
- getProductslist,
- getProductHot,
- storeCategory
- } from '@/api/store.js';
- import {
- initiateAssistApi
- } from '@/api/activity.js';
- import {
- openBargainSubscribe
- } from '@/utils/SubscribeMessage.js';
- import {
- setVisit,
- spread
- } from '@/api/user.js';
- import {
- isAndroid
- } from '@/utils/platform.js';
- import recommend from '@/components/recommend';
- // #ifndef H5
- import passwordPopup from '@/components/passwordPopup';
- // #endif
- // #ifdef H5
- import mConfig from './component/index.js';
- // #endif
- import authorize from '@/components/Authorize';
- // #ifdef MP || APP-PLUS
- import activeParty from './component/activeParty';
- import headerSerch from './component/headerSerch';
- import coupon from './component/coupon';
- import bargain from './component/bargain';
- import blankPage from './component/blankPage';
- import combination from './component/combination';
- import customerService from './component/customerService';
- import goodList from './component/goodList';
- import guide from './component/guide';
- import liveBroadcast from './component/liveBroadcast';
- import menus from './component/menus';
- import news from './component/news';
- import topic from './component/topic';
- import presellList from './component/presellList';
- import plantList from './component/plantList';
- import pictureCube from './component/pictureCube'
- import shopList from './component/shopList';
- import richText from './component/richText';
- import seckill from './component/seckill';
- import swiperBg from './component/swiperBg';
- import tabNav from './component/tabNav';
- import titles from './component/titles';
- // #endif
- import {
- silenceBindingSpread,
- configMap,
- isWeixin
- } from '@/utils/index';
- import history from '@/mixins/history';
- import shareScence from '@/libs/spread';
- import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue';
- import {
- getNewPeopleCouponLst
- } from '@/api/activity.js'
- import {
- HTTP_REQUEST_URL
- } from '@/config/app';
- export default {
- computed: configMap({
- hide_mer_status: 0,
- beian_sn: '',
- share_title: '',
- site_name: ''
- },
- mapGetters(['isLogin', 'uid', 'keyColor'])),
- mixins: [history],
- components: {
- easyLoadimage,
- recommend,
- authorize,
- // #ifndef H5
- passwordPopup,
- // #endif
- // #ifdef H5
- ...mConfig,
- // #endif
- // #ifdef MP || APP-PLUS
- activeParty,
- headerSerch,
- bargain,
- coupon,
- blankPage,
- combination,
- customerService,
- goodList,
- guide,
- liveBroadcast,
- menus,
- news,
- topic,
- presellList,
- plantList,
- pictureCube,
- shopList,
- richText,
- seckill,
- swiperBg,
- tabNav,
- titles
- // #endif
- },
- data() {
- return {
- list: [],//普通商品列表
- isAndroid: false,
- carouselList: [], //轮播图
- domain: HTTP_REQUEST_URL,
- couponTypeMsg: {
- 10: '通用券',
- 11: '品类券',
- 12: '跨店券'
- },
- styleConfig: [],
- showSkeleton: true, //骨架屏显示隐藏
- isNodes: 0, //控制什么时候开始抓取元素节点,只要数值改变就重新抓取
- privacyStatus: false,
- errorNetwork: false,
- ad: {
- home_ad_pic: ''
- },
- userInfo: {},
- loading: false,
- isAuto: false, //没有授权的不会自动授权
- isShowAuth: false, //是否隐藏授权
- statusBarHeight: statusBarHeight,
- navIndex: 0,
- navTop: [],
- subscribe: false,
- followUrl: '',
- followHid: true,
- followCode: false,
- imgUrls: [{
- url: '',
- pic: '',
- id: '',
- name: ''
- }],
- hot: [],
- sortList: [],
- menus: [{
- url: '',
- pic: '',
- id: '',
- name: ''
- }, {
- url: '',
- pic: '',
- id: '',
- name: ''
- }, {
- url: '',
- pic: '',
- id: '',
- name: ''
- }, {
- url: '',
- pic: '',
- id: '',
- name: ''
- }, {
- url: '',
- pic: '',
- id: '',
- name: ''
- }, {
- url: '',
- pic: '',
- id: '',
- name: ''
- }, {
- url: '',
- pic: '',
- id: '',
- name: ''
- }, {
- url: '',
- pic: '',
- id: '',
- name: ''
- }, {
- url: '',
- pic: '',
- id: '',
- name: ''
- }, {
- url: '',
- pic: '',
- id: '',
- name: ''
- }],
- window: false,
- navH: '',
- couponList: [],
- marTop: 0,
- loadend: false,
- loading: false,
- loadTitle: '加载更多',
- sortProduct: [],
- where: {
- // pid: 0,
- page: 1,
- limit: 30
- },
- is_switch: true,
- hostProduct: [],
- hotPage: 1,
- hotLimit: 30,
- hotScroll: true,
- hotLoading: false,
- hotTitle: '加载更多',
- explosiveMoney: [],
- prodeuctTop: 0,
- pinkInfo: '',
- searchH: 0,
- domOffsetTop: 50,
- // #ifdef APP-PLUS || MP
- isFixed: true,
- // #endif
- // #ifdef H5
- isFixed: false,
- // #endif
- goodScroll: true, //精品推荐开关
- params: {
- //精品推荐分页
- page: 1,
- limit: 10
- },
- tempArr: [], //精品推荐临时数组
- numConfig: 0,
- pageInfo: '', // 精品推荐全数据
- swiperCur: 0,
- d: '',
- h: '',
- m: '',
- s: '',
- sum_h: '',
- sortMarTop: 0,
- globalDatas: {},
- // #ifdef MP || APP-PLUS
- mpHeight: 108,
- // #endif
- // #ifndef MP || APP-PLUS
- mpHeight: 0,
- // #endif
- currSpid: '',
- _options: {},
- isIntegral: false,
- appUpdate: {},
- sortMpTop: 0,
- bgColor: '',
- bgPic: '',
- bgTabVal: '',
- windowHeight: 0,
- isHeaderSerch: false,
- showCoupon: false,
- couponArray: [],
-
- };
- },
- /**
- * 用户点击右上角分享
- */
- // #ifdef MP
- onShareAppMessage: function() {
- let that = this;
- wx.showShareMenu({
- withShareTicket: true,
- menus: ['shareAppMessage', 'shareTimeline']
- });
- return {
- title: that.share_title,
- path: '/pages/index/index?spid=' + that.uid
- };
- },
- onShareTimeline: function() {
- let that = this;
- return {
- title: that.share_title,
- query: {
- spid: that.uid
- },
- imageUrl: ''
- };
- },
- // #endif
- onLoad(options) {
- let that = this
- this._options = options;
- // #ifdef APP-PLUS
- const pages = getCurrentPages();
- const page = pages[pages.length - 1];
- const currentWebview = page.$getAppWebview();
- currentWebview.setStyle({
- pullToRefresh: {
- support: !that.isSupport,
- style: plus.os.name === 'Android' ? 'circle' : 'default'
- }
- });
- that.isSupport = !that.isSupport;
- that.appVersionConfig(); //APP版本检测
- // #endif
- that.$nextTick(function() {
- uni.getSystemInfo({
- success: function(res) {
- that.windowHeight = res.windowHeight;
- }
- });
- })
- that.pageLoad(options);
- setTimeout(() => {
- that.isNodes++;
- }, 100);
- },
- onShow() {
- this.getConfig();
- this.isIntegral = uni.getStorageSync('isIntegral')
- // #ifdef APP-PLUS
- if (this.appUpdate.openUpgrade == '1') {
- this.alertAppUpdate();
- }
- // #endif
- this.loadCoupon()
- // #ifdef H5
- this.isAndroid = isAndroid()
- // #endif
- // #ifdef APP-PLUS
- this.isAndroid = true
- // #endif
- console.log(this.isAndroid,'this.isAndroid')
- this.get_product_list();
- },
- onHide() {
- uni.setStorageSync('isIntegral', false)
- },
- onReady() {
- },
- watch: {
- globalDatas(nVal, oVal) {
- // #ifdef H5
- this.ShareInfo(nVal);
- // #endif
- },
- privacyStatus(n) {
- if (n) {
- uni.hideTabBar();
- } else {
- uni.showTabBar();
- }
- },
- },
- onPullDownRefresh() {
- setTimeout(() => {
- uni.stopPullDownRefresh();
- }, 100);
- this.reconnect();
- },
- methods: {
- //观看广告领奖
- openGg() {
- getUserInfo().then(res => {
- that.userInfo = res.data;
- this.$dsbridge.call("fnAds.onShowRewardVideoAD", {}, function(result) {
- let res = JSON.parse(result)
- if (res.event == 'onReward') {
- advertisement({
- task: '1'
- }).then(e => {
- }).catch(err => {})
- }
- });
- });
- },
- navto(url) {
- uni.navigateTo({
- url,
- fail() {
- uni.switchTab({
- url
- })
- }
- })
- },
- goCp() {
- window.location.href = 'http://web.mall.hqgjsmc.com/'
- },
- gozx() {
- window.location.href =
- 'https://chen.ningjuwang.com/shop/wap/27x50ex0ep39-qfKx#/index?preview_template_id=19&preview_page_id=190&preview_template_type=1'
- },
- swiperChange() {},
- bannerNavToUrl(item) {
- console.log(item)
- },
- changeBarg() {},
- loadCoupon() {
- if (!this.showCoupon && !uni.getStorageSync('show_coupon') && uni.getStorageSync('is_new_user')) {
- getNewPeopleCouponLst().then(res => {
- this.couponArray = res.data;
- setTimeout(() => {
- this.showCoupon = this.couponArray.length > 0;
- uni.setStorageSync('show_coupon', '1')
- }, 1500);
- })
- }
- },
- pageLoad(options) {
- let that = this;
- if (options.spid) {
- that.currSpid = options.spid;
- app.globalData.spid = options.spid;
- }
- // #ifdef APP-PLUS
- try {
- let val = uni.getStorageSync('privacyStatus') || false;
- if (!val) {
- this.privacyStatus = true;
- }
- } catch (e) {}
- this.snycNetWork();
- // #endif
- // #ifdef MP
- if (options.scene) {
- let value = that.$util.getUrlParams(decodeURIComponent(options.scene));
- if (value.id) options.id = value.id;
- //记录推广人uid
- if (value.spid) {
- that.currSpid = value.spid;
- app.globalData.spid = value.spid;
- }
- }
- // #endif
- shareScence(that.currSpid, that.isLogin);
- this.isLogin && silenceBindingSpread();
- this.getIndexConfig()
- Promise.all([
- this.diyData(),
- this.get_host_product(),
- ]);
- if (this.isLogin) {
- this.getUserInfo();
- // #ifdef MP
- this.getHistory();
- // #endif
- }
- },
- closeShare() {
- uni.setStorageSync('isIntegral', false);
- this.isIntegral = uni.getStorageSync('isIntegral');
- },
- bindHeighta(data) {
- // #ifdef APP-PLUS
- this.sortMpTop = data.top + data.height;
- // #endif
- },
- // 重新链接
- reconnect() {
- uni.getNetworkType({
- success: res => {
- this.errorNetwork = res.networkType === 'none';
- if (!this.errorNetwork) {
- this.pageLoad(this._options);
- }
- }
- });
- },
- // #ifdef APP-PLUS
- snycNetWork() {
- uni.getNetworkType({
- success: res => {
- this.errorNetwork = res.networkType === 'none';
- }
- });
- },
- // 同意隐私协议
- confirmApp() {
- uni.setStorageSync('privacyStatus', true);
- this.privacyStatus = false;
- },
- // 关闭 Model
- closeModel() {
- this.privacyStatus = false;
- },
- // #endif
- // 对象转数组
- objToArr(data) {
- let obj = Object.keys(data).sort();
- let m = obj.map(key => data[key]);
- return m;
- },
- diyData() {
- let that = this;
- getDiy().then(res => {
- setTimeout(() => {
- that.isNodes++;
- }, 0);
- that.errorNetwork = false
- uni.setNavigationBarTitle({
- title: res.data.title
- });
- let data = res.data;
- if (data.is_bg_color) {
- that.bgColor = data.color_picker
- }
- if (data.is_bg_pic) {
- that.bgPic = data.bg_pic
- that.bgTabVal = data.bg_tab_val
- }
- that.styleConfig = that.objToArr(res.data.value);
- that.styleConfig.forEach((item, index, arr) => {
- if (item.name == 'headerSerch') {
- that.isHeaderSerch = true
- }
- console.log(item.name)
- if (item.name == 'swiperBg') {
- that.carouselList = item.swiperConfig.list
- console.log(that.carouselList, 'ddddddddddddddddd')
- }
- });
- });
- },
- // 微信登录回调
- onLoadFun: function(e) {
- this.isShowAuth = false;
- },
- // #ifdef APP-PLUS
- appVersionConfig() {
- var that = this;
- //app升级
- // 获取本地应用资源版本号
- getAppVersion().then(res => {
- that.$set(that.appUpdate, 'androidAddress', res.data.androidAddress);
- that.$set(that.appUpdate, 'appVersion', res.data.appVersion);
- that.$set(that.appUpdate, 'iosAddress', res.data.iosAddress);
- that.$set(that.appUpdate, 'openUpgrade', res.data.openUpgrade);
- plus.runtime.getProperty(plus.runtime.appid, function(inf) {
- let nowVersion = (inf.version).split('.').join('');
- let appVersion = (res.data.appVersion).split('.').join('');
- that.$set(that.appUpdate, 'alert', appVersion > nowVersion);
- that.alertAppUpdate();
- });
- })
- },
- alertAppUpdate() {
- if (this.appUpdate.alert) {
- uni.getSystemInfo({
- success: (res) => {
- uni.showModal({
- title: '更新提示',
- content: '发现新版本,是否前去下载?',
- showCancel: this.appUpdate.openUpgrade !=
- '1',
- cancelColor: '#eeeeee',
- confirmColor: '#FF0000',
- success: (response) => {
- if (response.confirm) {
- switch (res.platform) {
- case "android":
- plus.runtime.openURL(this
- .appUpdate
- .androidAddress);
- break;
- case "ios":
- plus.runtime.openURL(encodeURI(
- this.appUpdate
- .iosAddress));
- break;
- }
- }
- }
- });
- }
- })
- }
- },
- // #endif
- getConfig() {
- // 获取配置
- getconfig()
- .then(res => {
- let self = this;
- this.globalDatas = res.data;
- uni.$emit('configData', res.data);
- })
- .catch(err => {});
- },
- // 分类页更多
- bindMore() {
- console.log(this.navTop[this.navIndex]);
- try {
- uni.setStorageSync('storeIndex', this.navTop[this.navIndex].pid);
- uni.switchTab({
- url: '/pages/goods_cate/goods_cate'
- });
- } catch (e) {}
- },
- goDetails(item) {
- goShopDetail(item, this.uid).then(res => {
- if (this.isLogin) {
- initiateAssistApi(item.activity_id)
- .then(res => {
- let id = res.data.product_assist_set_id;
- uni.hideLoading();
- // #ifndef MP
- uni.navigateTo({
- url: '/pages/activity/assist_detail/index?id=' + id
- });
- // #endif
- // #ifdef MP
- openBargainSubscribe()
- .then(res => {
- uni.hideLoading();
- uni.navigateTo({
- url: '/pages/activity/assist_detail/index?id=' + id
- });
- })
- .catch(err => {
- uni.hideLoading();
- });
- // #endif
- })
- .catch(err => {
- uni.showToast({
- title: err,
- icon: 'none'
- });
- });
- } else {
- this.isAuto = true;
- this.isShowAuth = true
- }
- });
- },
- /**
- * 获取个人用户信息
- */
- getUserInfo: function() {
- let that = this;
- getUserInfo().then(res => {
- that.userInfo = res.data;
- });
- },
- // 记录会员访问
- setVisit() {
- setVisit({
- url: '/pages/index/index'
- }).then(res => {
- console.log(res);
- });
- },
- // 导航分类切换
- changeTab(e) {
- let self = this;
- if (this.navIndex == e.index) return;
- this.navIndex = e.index;
- if (e.index > 0) {
- storeCategory({
- pid: e.pid
- }).then(res => {
- this.sortList = res.data.length > 9 ? res.data.splice(0, 9) : res.data;
- if (this.sortList.length > 0) {
- this.where.pid = e.pid;
- this.where.page = 1;
- this.loadend = false;
- this.loading = false;
- this.sortProduct = [];
- this.get_product_list();
- }
- });
- self.sortMarTop = 10;
- }
- },
- //分类产品
- get_product_list: function() {
- let that = this;
- if (that.loading) return;
- that.loading = true;
- that.loadTitle = '';
- getProductslist(that.where)
- .then(res => {
- let list = res.data.list;
- let productList = that.$util.SplitArray(list, that.sortProduct);
- let loadend = list.length < that.where.limit;
- that.loadend = loadend;
- that.loading = false;
- that.loadTitle = loadend ? '已全部加载' : '加载更多';
- that.$set(that, 'sortProduct', productList);
- console.log(that.sortProduct,'sortProduct+++++++++++++++++')
- that.$set(that.where, 'page', that.where.page + 1);
- })
- .catch(err => {
- that.loading = false;
- that.loadTitle = '加载更多';
- });
- },
- /**
- * 获取我的推荐
- */
- get_host_product: function() {
- let that = this;
- let num = that.hotLimit;
- if (!that.hotScroll) return;
- if (that.hotLoading) return;
- that.hotLoading = true;
- that.hotTitle = '';
- getProductHot(that.hotPage, that.hotLimit).then(res => {
- let list = res.data.list;
- let productList = that.$util.SplitArray(list, that.hostProduct);
- let hotScroll = list.length <= num && list.length != 0;
- that.hotScroll = hotScroll;
- that.hotLoading = false;
- that.hotTitle = !hotScroll ? '已全部加载' : '加载更多';
- that.$set(that, 'hostProduct', productList);
- that.$set(that, 'hotPage', that.hotPage + 1);
- });
- },
- // 首页数据
- getIndexConfig: function() {
- let that = this;
- getIndexData().then(res => {
- that.$set(that, 'imgUrls', res.data.banner);
- that.$set(that, 'menus', res.data.menu);
- that.$set(that, 'hot', res.data.hot);
- that.$set(that, 'ad', res.data.ad);
- res.data.category.unshift({
- cate_name: '首页'
- });
- that.$set(that, 'navTop', res.data.category);
- // #ifdef H5
- that.subscribe = res.data.subscribe;
- // #endif
- // 小程序判断用户是否授权;
- // #ifdef MP
- uni.getSetting({
- success(res) {
- if (!res.authSetting['scope.userInfo']) {
- that.window = that.couponList.length ? true : false;
- } else {
- that.window = false;
- }
- }
- });
- // #endif
- // #ifndef MP
- if (that.isLogin) {
- that.window = false;
- } else {
- that.window = that.couponList.length ? true : false;
- }
- // #endif
- that.reloadData();
- });
- },
- reloadData() {
- setTimeout(() => {
- this.showSkeleton = false
- }, 500)
- },
- // 授权关闭
- authColse: function(e) {
- this.isShowAuth = e;
- },
- // 首发新品详情
- goDetail(item) {
- if (item.activity && item.activity.type === '2' && !this.isLogin) {
- // #ifdef H5
- uni.showModal({
- title: '提示',
- content: '您未登录,请登录!',
- success: function(res) {
- if (res.confirm) {
- uni.navigateTo({
- url: '/pages/users/login/index'
- });
- } else if (res.cancel) {}
- }
- });
- // #endif
- // #ifdef MP
- this.$set(this, 'isAuto', true);
- this.$set(this, 'isShowAuth', true);
- // #endif
- return;
- } else {
- goShopDetail(item, this.uid).then(res => {
- uni.navigateTo({
- url: `/pages/goods_details/index?id=${item.id}`
- });
- });
- }
- },
- // 分类详情
- godDetail(item) {
- uni.navigateTo({
- url: `/pages/goods_details/index?id=${item.id}`
- });
- },
- //拼团详情
- goCombinDetail(item) {
- uni.navigateTo({
- url: `/pages/activity/combination_details/index?id=${item.product_group_id}`
- });
- },
- countTime: function() {
- // 获取当前时间
- var date = new Date();
- var now = date.getTime();
- //设置截止时间
- var endDate = new Date('2020-10-22 23:23:23');
- var end = endDate.getTime();
- //时间差
- var leftTime = end - now;
- //定义变量 d,h,m,s保存倒计时的时间
- if (leftTime >= 0) {
- this.d = Math.floor(leftTime / 1000 / 60 / 60 / 24);
- this.h = Math.floor((leftTime / 1000 / 60 / 60) % 24);
- this.m = Math.floor((leftTime / 1000 / 60) % 60);
- this.s = Math.floor((leftTime / 1000) % 60);
- this.sum_h = this.d * 24 + this.h;
- }
- //递归每秒调用countTime方法,显示动态时间效果
- setTimeout(this.countTime, 1000);
- },
- //#ifdef H5
- ShareInfo(datas) {
- let data = this.storeInfo;
- let href = location.href;
- if (this.$wechat.isWeixin()) {
- if (this.isLogin) {
- href = href.indexOf('?') === -1 ? href + '?spid=' + this.uid : href + '&spid=' + this.uid;
- } else {
- href = href;
- }
- let configAppMessage = {
- desc: datas.share_info,
- title: datas.share_title,
- link: href,
- imgUrl: datas.share_pic
- };
- this.$wechat
- .wechatEvevt(['updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareAppMessage',
- 'onMenuShareTimeline'
- ], configAppMessage)
- .then(res => {
- console.log(res, '=============================>>WXAPI');
- })
- .catch(err => {
- console.log(err);
- });
- }
- },
- //#endif
- },
- mounted() {
- },
- // 滚动到底部
- onReachBottom() {
- if (this.navIndex == 0) {
- // 首页加载更多
- this.get_host_product();
- } else {
- // 分类栏目加载更多
- if (this.sortProduct.length > 0) {
- this.get_product_list();
- } else {
- this.get_host_product();
- }
- }
- },
- // 滚动监听
- onPageScroll(e) {
- // #ifdef H5
- if (this.isHeaderSerch) {
- if (e.scrollTop > this.domOffsetTop) {
- this.isFixed = true;
- }
- if (e.scrollTop < this.domOffsetTop) {
- this.$nextTick(() => {
- this.isFixed = false;
- });
- }
- } else {
- this.isFixed = false
- }
- // #endif
- // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
- uni.$emit('scroll');
- }
- };
- </script>
- <style>
- </style>
- <style lang="scss">
- page,
- .center {
- min-height: 100%;
- height: auto;
- background: #fff;
- }
- // 顶部搜索
- .top-search {
- height: 80rpx;
- // padding: 0 20rpx;
- // background-color: #338fc0;
- background-color: #478fbf;
- justify-content: center;
- .search-box {
- justify-content: center;
- width: 700rpx;
- height: 60rpx;
- background: #fff;
- // box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
- border-radius: 30rpx;
- .search {
- width: 34rpx;
- height: 34rpx;
- }
- .search-font {
- margin-left: 14rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #CBCBCB;
- }
- }
- }
- // 顶部轮播图
- .swiper-wrap {
- width: 750rpx;
- // background-color: #338fc0;
- background-color: #478fbf;
- .top-swiper {
- width: 700rpx;
- height: 350rpx;
- margin: auto;
- border-radius: 20rpx;
- image {
- width: 700rpx;
- height: 350rpx;
- border-radius: 20rpx;
- }
- }
- }
- .swiper-btm {
- height: 60rpx;
- width: 750rpx;
- background-color: #fff;
- margin-bottom: 20rpx;
- font-size: 21rpx;
- font-weight: 500;
- color: #333333;
- .btm-item {
- flex-grow: 1;
- justify-content: center;
- image {
- width: 25rpx;
- height: 25rpx;
- margin-right: 14rpx;
- }
- }
- }
- .jg {
- height: 20rpx;
- // background-color: #338fc0;
- background-color: #478fbf;
- }
- .status_bar {
- height: var(--status-bar-height);
- width: 100%;
- // background: #338fc0;
- background-color: #478fbf;
- }
- // 分类
- .cate-section {
- justify-content: space-around;
- background-color: #fff;
- padding: 0rpx 0 30rpx;
- // background: #338fc0;
- background-color: #478fbf;
- .cate-item {
- flex-grow: 0;
- width: 20%;
- flex-direction: column;
- text-align: center;
- align-items: center;
- justify-content: center;
- .img-wrapper {
- width: 90rpx;
- height: 90rpx;
- border-radius: 20rpx;
- position: relative;
- image {
- width: 90rpx;
- height: 90rpx;
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- }
- }
- .item-title {
- margin-top: 15rpx;
- font-size: 26rpx;
- font-weight: 500;
- color: #FFFFFF;
- }
- }
- }
- // 专区
- .zq-wrap {
- height: 345rpx;
- width: 750rpx;
- background: linear-gradient(180deg, #338fc0, #fff);
- padding: 0 27rpx;
- .zq-item {
- width: 342rpx;
- height: 300rpx;
- background: linear-gradient(180deg, #fc2f40, #fb829e);
- border-radius: 20rpx;
- box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.2);
- position: relative;
- .zq-tit {
- padding: 15rpx 0 0 20rpx;
- font-size: 32rpx;
- font-weight: bold;
- font-style: italic;
- color: #FFFFFF;
- }
- .item-info {
- position: absolute;
- bottom: 8rpx;
- left: 0;
- right: 0;
- margin: auto;
- width: 324rpx;
- height: 232rpx;
- background: #FFFFFF;
- border-radius: 20rpx;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- image {
- width: 294rpx;
- height: 160rpx;
- }
- .info-tit {
- margin-top: 12rpx;
- width: 189rpx;
- height: 36rpx;
- image {
- width: 189rpx;
- }
- }
- }
- }
- .bd {
- background: linear-gradient(180deg, #ff601a, #feba9d);
- }
- }
- .product-box {
- margin-top: 20rpx;
- background: #ffffff;
- padding: 26rpx 20rpx 20rpx;
- .product-tit {
- justify-content: center;
- .hx {
- width: 120rpx;
- height: 1rpx;
- background: #989898;
- }
- .tit {
- margin: 0 70rpx;
- font-size: 30rpx;
- font-weight: 500;
- color: #363636;
- }
- }
- }
- .hotgoods {
- margin-top: 38rpx;
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- padding: 0 0 30rpx;
- justify-content: space-between;
- .hotgoods-item {
- width: 345rpx;
- background-color: #ffffff;
- border-radius: 12rpx;
- box-shadow: 0 0 15rpx rgba(0, 0, 0, 0.2);
- margin-bottom: 15rpx;
- .image-wrapper {
- width: 345rpx;
- height: 345rpx;
- border-radius: 3px;
- overflow: hidden;
- position: relative;
- .image-bg {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- width: 100%;
- height: 100%;
- opacity: 1;
- border-radius: 12rpx 12rpx 0 0;
- z-index: 2;
- }
- .image {
- width: 100%;
- height: 100%;
- opacity: 1;
- border-radius: 12rpx 12rpx 0 0;
- }
- }
- .title {
- margin-top: 24rpx;
- padding: 0 20rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- .hot-price {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- // padding: 14rpx 0 30rpx;
- .hotPrice-box {
- padding: 2rpx 6rpx;
- background: linear-gradient(90deg, #c79a4c, #f9df7f);
- border-radius: 5rpx;
- text-align: center;
- line-height: 28rpx;
- font-size: 20rpx;
- font-family: Source Han Sans CN;
- font-weight: 400;
- color: #ffffff;
- }
- .price {
- margin-left: 10rpx;
- font-size: 40rpx;
- color: #ff0000;
- font-weight: 500;
- .jf {
- font-size: 20rpx;
- }
- }
- .yuanPrice {
- margin-left: 10rpx;
- font-size: 20rpx;
- font-family: PingFang SC;
- font-weight: 500;
- text-decoration: line-through;
- color: #999999;
- }
- .cart-icon {
- image {
- width: 44rpx;
- height: 44rpx;
- }
- }
- }
- }
- }
- .sbkh-wrap {
- width: 750rpx;
- height: 362rpx;
- position: relative;
- image {
- position: absolute;
- top: 0;
- left: 0;
- width: 750rpx;
- height: 362rpx;
- }
- .sbkh-xfzq,
- .sbkh-jfzq {
- width: 340rpx;
- height: 300rpx;
- position: absolute;
- }
- .sbkh-xfzq {
- top: 40rpx;
- left: 27rpx;
- }
- .sbkh-jfzq {
- top: 40rpx;
- right: 27rpx;
- }
- }
- .mf-wrap {
- .mf {
- transform-style: prserve-3d;
- perspective: 500;
- position: relative;
- height: 200rpx;
- width: 200rpx;
- background-color: #bfa;
- }
- image {
- position: absolute;
- width: 100rpx;
- height: 100rpx;
- }
- .top {
- transform: rotateX(90deg);
- transform-origin: 0 0;
- }
- .bottom {
- transform: rotateX(90deg);
- transform-origin: 0 100%;
- }
- }
- .page-btm {
- background-color: #f5f5f5;
- font-size: 20rpx;
- text-align: center;
- color: #d6d6d8;
- }
- </style>
|