| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482 |
- <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 imgUrls" :key="index" class="carousel-item"
- @click="bannerNavToUrl(item)">
- <image :src="item.pic" />
- </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/c5.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="where.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,
- advertisement
- } 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,
- loadingType: 'more',
- 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: {
- gocx() {
- window.location.href = 'https://www.miit.gov.cn/'
- },
- //观看广告领奖
- openGg() {
- let that = this
- getUserInfo().then(res => {
- that.userInfo = res.data;
- that.$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)
- uni.navigateTo({
- url: item.url,
- fail() {
- uni.switchTab({
- url:item.url
- })
- }
- })
- },
- 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;
- if(that.where.loadingType == 'noMore' || that.where.loadingType == 'loading') {
- return
- }
- // that.loading = true;
- // that.loadTitle = '';
- that.where.loadingType = 'loading'
- 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;
- if(loadend) {
- that.where.loadingType = 'noMore'
- }else {
- that.where.loadingType = 'more'
- }
- // 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() {
- console.log('daodile')
- this.get_product_list();
- // 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>
|