index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  1. <template>
  2. <view id="pageIndex" :style="colorStyle">
  3. <!-- <skeleton v-if="!isIframe" :show="showSkeleton" :isNodes="isNodes" ref="skeleton" loading="chiaroscuro"
  4. selector="skeleton" bgcolor="#FFF"></skeleton> -->
  5. <skeletons :show="showSkeleton" loading="chiaroscuro" bgcolor="#FFF"></skeletons>
  6. <!-- #ifdef H5 -->
  7. <view class="followMe" v-if="$wechat.isWeixin()">
  8. <view class="follow acea-row row-between-wrapper" v-if="followHid && followUrl && !subscribe">
  9. <view>点击“立即关注”即可关注公众号</view>
  10. <view class="acea-row row-middle">
  11. <view class="bnt" @click="followTap">立即关注</view>
  12. <span class="iconfont icon-guanbi" @click="closeFollow"></span>
  13. </view>
  14. </view>
  15. <view class="followCode" v-if="followCode">
  16. <view class="pictrue"><img :src="followUrl" /></view>
  17. <view class="mask" @click="closeFollowCode"></view>
  18. </view>
  19. </view>
  20. <!-- #endif -->
  21. <!-- #ifdef MP -->
  22. <view class="indexTip" :style="'top:' + (navH+50) + 'px'" :hidden="iShidden">
  23. <view class="tip acea-row row-between-wrapper">
  24. <view class="text">点击“<image src="../../static/images/spot.png"></image>”添加到我的小程序, 微信首页下拉即可访问商城。</view>
  25. <view class="iconfont icon-guanbi1" @click="closeTip"></view>
  26. </view>
  27. </view>
  28. <!-- #endif -->
  29. <!-- 顶部搜索 -->
  30. <view class="skeleton" id="pageIndexs" :style="{visibility: showSkeleton ? 'hidden' : 'visible'}">
  31. <headerSerch class="mp-header skeleton" :dataConfig="headerSerch.default"
  32. @click.native="bindEdit('headerSerch','default')"></headerSerch>
  33. <!-- 轮播 -->
  34. <swiperBg :dataConfig="swiperBg.default" @click.native="bindEdit('swiperBg','default')"></swiperBg>
  35. <!-- 金刚区 -->
  36. <menus :dataConfig="menus.default" @click.native="bindEdit('menus','default')">
  37. </menus>
  38. <!-- 新闻简报 -->
  39. <news :dataConfig="news.default" @click.native="bindEdit('news','default')"></news>
  40. <!-- 活动魔方 -->
  41. <activity :dataConfig="activity.default" @click.native="bindEdit('activity','default')"></activity>
  42. <!-- <seckill :dataConfig="seckill.default" @click.native="bindEdit('seckill','default')"></seckill>
  43. <adsRecommend :dataConfig="adsRecommend.default" @click.native="bindEdit('adsRecommend','default')"></adsRecommend>
  44. <combination :dataConfig="combination.default" @click.native="bindEdit('combination','default')"></combination>
  45. <bargain :dataConfig="bargain.default" @click.native="bindEdit('bargain','default')"></bargain>
  46. <goodList :dataConfig="goodList.default" @click.native="bindEdit('goodList','default')"></goodList>
  47. <picTxt :dataConfig="picTxt.default" @click.native="bindEdit('picTxt','default')"></picTxt> -->
  48. <alive :dataConfig="alive.default" @click.native="bindEdit('alive','default')">
  49. </alive>
  50. <!-- 优惠券 -->
  51. <coupon :dataConfig="coupon.default" @click.native="bindEdit('coupon','default')">
  52. </coupon>
  53. <!-- 快速选择 -->
  54. <scrollBox :dataConfig="scrollBox.default" @click.native="bindEdit('scrollBox','default')"></scrollBox>
  55. <!-- 促销精品 -->
  56. <recommend :dataConfig="goodList.aa" @click.native="bindEdit('goodList','aa')">
  57. </recommend>
  58. <!-- 排行榜 -->
  59. <popular :dataConfig="goodList.bb" @click.native="bindEdit('goodList','bb')">
  60. </popular>
  61. <!-- 商品轮播 -->
  62. <mBanner :dataConfig="swiperBg.aa" @click.native="bindEdit('swiperBg','aa')">
  63. </mBanner>
  64. <!-- 首发新品 -->
  65. <newGoods :dataConfig="goodList.cc" @click.native="bindEdit('goodList','cc')">
  66. </newGoods>
  67. <!-- 精品推荐 -->
  68. <!-- <mBanner :dataConfig="swiperBg.cc" @click.native="bindEdit('swiperBg','cc')"></mBanner> -->
  69. <!-- <titles :dataConfig="titles.default" :sty="'off'" @click.native="bindEdit('titles','default')"></titles> -->
  70. <!-- 商品轮播 -->
  71. <!-- <customerService :dataConfig="customerService.default" @click.native="bindEdit('customerService','default')"></customerService> -->
  72. <!-- 促销单品 -->
  73. <promotion :dataConfig="goodList.dd" @click.native="bindEdit('goodList','dd')">
  74. </promotion>
  75. <!-- 商品分类 -->
  76. <tabNav class="sticky-box" :style="'top:'+ isTop+'px;'" :dataConfig="tabNav.default"
  77. @click.native="bindEdit('tabNav','default')" @bindSortId="bindSortId" @bindHeight="bindHeighta">
  78. </tabNav>
  79. <!-- 商品列表 -->
  80. <goodsWaterfall :class="{'nothing':loading}" v-if="!isIframe && tabNav.default && tabNav.default.isShow.val"
  81. :dataLists="goodLists" @click.native="bindEdit('List')"></goodsWaterfall>
  82. <Loading class="loading-sty" :loaded="loaded" :loading="loading"></Loading>
  83. <view class=""
  84. v-if="!isIframe && tabNav.default && tabNav.default.isShow.val && goodLists.length == 0 && !loading">
  85. <view class="empty-box">
  86. <image src="/static/images/noShopper.png"></image>
  87. </view>
  88. </view>
  89. </view>
  90. <tabBar :dataConfig="tabBar.default" :pagePath="'/pages/index/index'"
  91. @click.native="bindEdit('tabBar','default')"></tabBar>
  92. <view v-if="site_config && !isIframe" class="site-config" @click="goICP">{{ site_config }}</view>
  93. <view class="uni-p-b-98"></view>
  94. <couponWindow style="position:relative;z-index:10000;" :window="isCouponShow" @onColse="couponClose"
  95. :couponImage="couponObj.image" :couponList="couponObj.list"></couponWindow>
  96. <!-- #ifdef APP-PLUS -->
  97. <!-- <app-update v-if="!privacyStatus" ref="appUpdate" :force="true" :tabbar="false"></app-update> -->
  98. <!-- #endif -->
  99. <!-- #ifdef APP-PLUS -->
  100. <view class="privacy-wrapper" v-if="privacyStatus">
  101. <view class="privacy-box">
  102. <view class="title">服务协议与隐私政策</view>
  103. <view class="content">
  104. 请务必审慎阅读、充分理解“服务协议与 隐私政策”各条款,包括但不限于:为了 向你提供即时通讯、内容分享等服务,我 们需要收集你的设备信息、操作日志等个 人信息。你可以在“设置”中查看、变更、
  105. 删除个人信息并管理你的授权。<br>
  106. 你可以阅读<navigator url="/pages/users/privacy/index">《服务协议与隐私政策》</navigator>了解
  107. 详细信息。如你同意,请点击“我同意”开始接受我们的服务。
  108. </view>
  109. <view class="btn-box">
  110. <view class="btn-item" @click="confirmApp">我同意</view>
  111. <view class="btn" @click="closeModel">残忍拒绝</view>
  112. </view>
  113. </view>
  114. </view>
  115. <!-- #endif -->
  116. </view>
  117. </template>
  118. <script>
  119. import couponWindow from '@/components/couponWindow/index';
  120. import headerSerch from './components/headerSerch';
  121. import swiperBg from './components/swiperBg';
  122. import menus from './components/menus';
  123. import news from './components/news';
  124. import activity from './components/activity';
  125. import scrollBox from './components/scrollBox';
  126. import recommend from './components/recommend';
  127. import popular from './components/popular';
  128. import mBanner from './components/mBanner';
  129. import newGoods from './components/newGoods';
  130. import promotion from './components/promotion';
  131. import alive from './components/alive';
  132. import adsRecommend from './components/adsRecommend';
  133. import coupon from './components/coupon';
  134. import seckill from './components/seckill';
  135. import combination from './components/combination';
  136. import bargain from './components/bargain';
  137. import goodList from './components/goodList';
  138. import picTxt from './components/picTxt';
  139. import titles from './components/titles';
  140. import customerService from './components/customerService';
  141. import tabBar from './components/tabBar';
  142. import tabNav from './components/tabNav';
  143. import appUpdate from "./update/app-update.vue"
  144. import Loading from '@/components/Loading/index.vue';
  145. import {
  146. getShare,
  147. follow
  148. } from '@/api/public.js';
  149. // #ifdef MP || APP-PLUS
  150. import {
  151. SUBSCRIBE_MESSAGE,
  152. TIPS_KEY
  153. } from '@/config/cache';
  154. // #endif
  155. import {
  156. getTemlIds,
  157. siteConfig
  158. } from '@/api/api.js';
  159. import {
  160. mapGetters
  161. } from 'vuex';
  162. import {
  163. getDiy,
  164. getIndexData,
  165. getCouponV2,
  166. getCouponNewUser
  167. } from '@/api/api.js';
  168. import {
  169. getGroomList,
  170. getCategoryList,
  171. getProductslist,
  172. getProductHot
  173. } from '@/api/store.js';
  174. import {
  175. goShopDetail,
  176. goPage
  177. } from '@/libs/order.js'
  178. import {
  179. toLogin
  180. } from '@/libs/login.js';
  181. import colors from "@/mixins/color";
  182. import goodsWaterfall from "@/components/goodsWaterfall/goodsWaterfall.vue"
  183. import skeletons from './components/skeleton.vue'
  184. let app = getApp();
  185. let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  186. export default {
  187. computed: mapGetters(['isLogin', 'uid']),
  188. components: {
  189. couponWindow,
  190. headerSerch,
  191. swiperBg,
  192. menus,
  193. news,
  194. activity,
  195. scrollBox,
  196. recommend,
  197. popular,
  198. mBanner,
  199. newGoods,
  200. promotion,
  201. alive,
  202. adsRecommend,
  203. coupon,
  204. seckill,
  205. combination,
  206. bargain,
  207. goodList,
  208. picTxt,
  209. titles,
  210. customerService,
  211. tabBar,
  212. tabNav,
  213. Loading,
  214. goodsWaterfall,
  215. skeletons,
  216. appUpdate, //APP更新
  217. },
  218. mixins: [colors],
  219. data() {
  220. return {
  221. showSkeleton: true, //骨架屏显示隐藏
  222. isNodes: 0, //控制什么时候开始抓取元素节点,只要数值改变就重新抓取
  223. isSortType: 0,
  224. sortList: {},
  225. sortAll: [],
  226. goodPage: 1,
  227. goodLists: [],
  228. curSort: 0,
  229. sortMpTop: 0,
  230. loaded: false,
  231. hostProduct: [],
  232. hotScroll: false,
  233. hotPage: 1,
  234. hotLimit: 10,
  235. followHid: true,
  236. followUrl: '',
  237. followCode: false,
  238. navH: statusBarHeight,
  239. subscribe: false,
  240. iShidden: false,
  241. goodType: 3,
  242. loading: false,
  243. loadend: false,
  244. loadTitle: '下拉加载更多', //提示语
  245. page: 1,
  246. limit: this.$config.LIMIT,
  247. numConfig: 0,
  248. couponObj: {},
  249. isCouponShow: false,
  250. shareInfo: {},
  251. site_config: '',
  252. isIframe: app.globalData.isIframe,
  253. headerSerch: {}, //头部搜索
  254. swiperBg: {}, //轮播
  255. menus: {}, //导航
  256. news: {}, //消息公告
  257. activity: {}, //活动魔方
  258. alive: {},
  259. scrollBox: {}, //快速选择分类
  260. titles: {}, //标题
  261. goodList: {}, //商品列表(商品列表、首发新品、热门榜单、促销单品、精品推荐)
  262. tabBar: {}, //导航
  263. customerService: {}, //客服
  264. picTxt: {}, //图文详情
  265. bargain: {}, //砍价
  266. combination: {}, //拼团
  267. adsRecommend: {}, //广告位
  268. seckill: {}, //秒杀
  269. coupon: {}, //优惠券
  270. tabNav: {}, //分类tab
  271. isBorader: '',
  272. domOffsetTop: 50,
  273. isTop: 0,
  274. privacyStatus: false, // 隐私政策是否同意过
  275. isFixed: false,
  276. };
  277. },
  278. onLoad(options) {
  279. uni.hideTabBar();
  280. // #ifdef APP-PLUS
  281. this.$nextTick(() => {
  282. // this.$refs.appUpdate.update(); //调用子组件 检查更新
  283. })
  284. try {
  285. let val = uni.getStorageSync('privacyStatus') || false
  286. if (!val) {
  287. this.privacyStatus = true
  288. }
  289. } catch (e) {}
  290. // #endif
  291. let that = this;
  292. // // #ifdef MP
  293. // if (options.scene) app.globalData.code = decodeURIComponent(options.scene)
  294. // if (options.spid) app.globalData.spid = options.spid;
  295. // // #endif
  296. // #ifdef H5
  297. if (app.globalData.isIframe) {
  298. this.showSkeleton = false
  299. setTimeout(() => {
  300. let active;
  301. document.getElementById('pageIndexs').children.forEach(dom => {
  302. dom.addEventListener('click', (e) => {
  303. e.stopPropagation();
  304. e.preventDefault();
  305. if (dom === active) return;
  306. dom.classList.add('borderShow');
  307. active && active.classList.remove('borderShow');
  308. active = dom;
  309. })
  310. })
  311. }, 1000);
  312. }
  313. if (app.globalData.isIframe) {
  314. uni.hideTabBar();
  315. }
  316. this.getFollow();
  317. if (that.$wechat.isWeixin()) {
  318. that.$wechat.location().then(res => {
  319. uni.setStorageSync('user_latitude', res.latitude);
  320. uni.setStorageSync('user_longitude', res.longitude);
  321. })
  322. } else {
  323. // #endif
  324. uni.getLocation({
  325. type: 'wgs84',
  326. success: function(res) {
  327. try {
  328. uni.setStorageSync('user_latitude', res.latitude);
  329. uni.setStorageSync('user_longitude', res.longitude);
  330. } catch {}
  331. }
  332. });
  333. // #ifdef H5
  334. }
  335. // #endif
  336. this.diyData();
  337. this.getIndexData();
  338. this.setOpenShare();
  339. // #ifdef MP
  340. if (this.$Cache.get(TIPS_KEY)) this.iShidden = true;
  341. this.getTemlIds();
  342. // #endif
  343. siteConfig().then(res => {
  344. this.site_config = res.data.record_No
  345. }).catch(err => {
  346. return this.$util.Tips({
  347. title: err.msg
  348. });
  349. });
  350. // #ifdef APP-PLUS
  351. this.isTop = uni.getSystemInfoSync().statusBarHeight + 100
  352. // #endif
  353. // #ifdef MP
  354. let info = uni.createSelectorQuery().select(".mp-header");
  355. info.boundingClientRect((data) => {
  356. this.isTop = data.top
  357. }).exec()
  358. // #endif
  359. // #ifdef H5
  360. this.isTop = 0
  361. // #endif
  362. },
  363. onPullDownRefresh() {
  364. this.diyData();
  365. this.getIndexData();
  366. },
  367. // #ifdef MP
  368. //发送给朋友
  369. onShareAppMessage: function() {
  370. // 此处的distSource为分享者的部分信息,需要传递给其他人
  371. let that = this;
  372. return {
  373. title: this.shareInfo.title,
  374. path: '/pages/index/index',
  375. imageUrl: this.shareInfo.img
  376. };
  377. },
  378. //分享到朋友圈
  379. onShareTimeline: function() {
  380. return {
  381. title: this.shareInfo.title,
  382. imageUrl: this.shareInfo.img
  383. };
  384. },
  385. // #endif
  386. onShow() {
  387. if (!app.globalData.isIframe) {
  388. // uni.showTabBar();
  389. if (this.isLogin) {
  390. this.getCoupon();
  391. }
  392. }
  393. },
  394. methods: {
  395. // #ifdef APP-PLUS
  396. // 同意隐私协议
  397. confirmApp() {
  398. uni.setStorageSync('privacyStatus', true)
  399. this.privacyStatus = false
  400. },
  401. // 关闭Model
  402. closeModel() {
  403. //退出app
  404. uni.getSystemInfo({
  405. success: function(res) { // 判断为安卓的手机
  406. if (res.platform == 'android') { // 安卓退出app
  407. plus.runtime.quit();
  408. } else { // 判断为ios的手机,退出App
  409. plus.ios.import("UIApplication").sharedApplication().performSelector("exit");
  410. }
  411. }
  412. })
  413. },
  414. // #endif
  415. bindEdit(name, dataName) {
  416. if (app.globalData.isIframe) {
  417. window.parent.postMessage({
  418. name: name,
  419. dataName: dataName,
  420. params: {}
  421. },
  422. '*'
  423. );
  424. return;
  425. }
  426. },
  427. getFollow() {
  428. follow().then(res => {
  429. this.followUrl = res.data.path;
  430. }).catch((err) => {
  431. return this.$util.Tips({
  432. title: err.msg
  433. });
  434. });
  435. },
  436. followTap() {
  437. this.followCode = true;
  438. this.followHid = false;
  439. },
  440. closeFollow() {
  441. this.followHid = false;
  442. },
  443. closeFollowCode() {
  444. this.followCode = false;
  445. this.followHid = true;
  446. },
  447. closeTip: function() {
  448. this.$Cache.set(TIPS_KEY, true);
  449. this.iShidden = true;
  450. },
  451. bindHeighta(data) {
  452. // #ifdef APP-PLUS
  453. this.sortMpTop = data.top + data.height;
  454. // #endif
  455. // #ifdef H5
  456. this.domOffsetTop = data.top;
  457. // #endif
  458. // #ifndef H5
  459. this.domOffsetTop = data.top - 110;
  460. // #endif
  461. },
  462. // 优惠券弹窗
  463. getCoupon() {
  464. const tagDate = uni.getStorageSync('tagDate') || '',
  465. nowDate = new Date().toLocaleDateString();
  466. if (tagDate === nowDate) {
  467. this.getNewCoupon();
  468. } else {
  469. getCouponV2().then(res => {
  470. const {
  471. data
  472. } = res;
  473. if (data.list.length) {
  474. this.isCouponShow = true;
  475. this.couponObj = data;
  476. uni.setStorageSync('tagDate', new Date().toLocaleDateString());
  477. } else {
  478. this.getNewCoupon();
  479. }
  480. });
  481. }
  482. },
  483. // 新用户优惠券
  484. getNewCoupon() {
  485. const oldUser = uni.getStorageSync('oldUser') || 0;
  486. if (!oldUser) {
  487. getCouponNewUser().then(res => {
  488. const {
  489. data
  490. } = res;
  491. if (data.show) {
  492. if (data.list.length) {
  493. this.isCouponShow = true;
  494. this.couponObj = data;
  495. uni.setStorageSync('oldUser', 1);
  496. }
  497. } else {
  498. uni.setStorageSync('oldUser', 1);
  499. }
  500. });
  501. }
  502. },
  503. // 优惠券弹窗关闭
  504. couponClose() {
  505. this.isCouponShow = false;
  506. if (!uni.getStorageSync('oldUser')) {
  507. this.getNewCoupon();
  508. }
  509. },
  510. // 授权关闭
  511. // authColse: function(e) {
  512. // this.isShowAuth = e;
  513. // },
  514. // #ifdef MP
  515. getTemlIds() {
  516. let messageTmplIds = wx.getStorageSync(SUBSCRIBE_MESSAGE);
  517. if (!messageTmplIds) {
  518. getTemlIds().then(res => {
  519. if (res.data) wx.setStorageSync(SUBSCRIBE_MESSAGE, JSON.stringify(res.data));
  520. });
  521. }
  522. },
  523. // #endif
  524. goICP() {
  525. // #ifdef H5
  526. window.open('http://beian.miit.gov.cn/');
  527. // #endif
  528. // #ifdef MP
  529. uni.navigateTo({
  530. url: `/pages/annex/web_view/index?url=https://beian.miit.gov.cn/`
  531. });
  532. // #endif
  533. },
  534. onLoadFun() {},
  535. diyData() {
  536. let that = this;
  537. getDiy().then(res => {
  538. let data = res.data;
  539. that.headerSerch = data.headerSerch;
  540. that.swiperBg = data.swiperBg;
  541. that.menus = data.menus;
  542. that.news = data.news;
  543. that.activity = data.activity;
  544. that.alive = data.alive;
  545. that.scrollBox = data.scrollBox;
  546. that.titles = data.titles;
  547. that.goodList = data.goodList;
  548. that.tabNav = data.tabNav;
  549. that.tabBar = data.tabBar;
  550. that.customerService = data.customerService;
  551. that.picTxt = data.picTxt;
  552. that.bargain = data.bargain;
  553. that.combination = data.combination;
  554. that.adsRecommend = data.adsRecommend;
  555. that.seckill = data.seckill;
  556. that.coupon = data.coupon;
  557. this.$Cache.set('TAB_BAR', data.tabBar.default.tabBarList)
  558. setTimeout(() => {
  559. this.showSkeleton = false
  560. }, 1500)
  561. uni.stopPullDownRefresh({
  562. success: (e) => {}
  563. });
  564. });
  565. },
  566. getIndexData() {
  567. getIndexData().then(res => {
  568. this.subscribe = res.data.subscribe;
  569. // #ifdef H5
  570. localStorage.setItem("itemName", res.data.site_name);
  571. // #endif
  572. uni.setNavigationBarTitle({
  573. title: res.data.site_name
  574. });
  575. });
  576. },
  577. /**
  578. * 获取我的推荐
  579. */
  580. get_host_product: function() {
  581. let that = this;
  582. if (that.hotScroll) return;
  583. getProductHot(that.hotPage, that.hotLimit).then(res => {
  584. that.hotPage++;
  585. that.hotScroll = res.data.length < that.hotLimit;
  586. that.hostProduct = that.hostProduct.concat(res.data);
  587. // that.$set(that, 'hostProduct', res.data)
  588. });
  589. },
  590. // 获取分类id
  591. bindSortId(data) {
  592. this.isSortType = data == -99 ? 0 : 1;
  593. this.goodLists = []
  594. this.getProductList(data);
  595. },
  596. getProductList(data) {
  597. let tempObj = '';
  598. this.curSort = 0;
  599. this.loaded = false;
  600. this.goodPage = 1
  601. this.getGoodsList(data)
  602. },
  603. getGoodsList(data) {
  604. if (this.loading || this.loaded) return;
  605. this.loading = true;
  606. getProductslist({
  607. keyword: '',
  608. priceOrder: '',
  609. salesOrder: '',
  610. news: 0,
  611. page: this.goodPage,
  612. limit: 10,
  613. cid: data
  614. }).then(res => {
  615. this.goodLists = this.goodLists.concat(res.data);
  616. this.loading = false;
  617. this.loaded = res.data.length < 10;
  618. this.goodPage++;
  619. });
  620. },
  621. goGoodsDetail(item) {
  622. goPage().then(res => {
  623. goShopDetail(item, this.uid).then(res => {
  624. uni.navigateTo({
  625. url: `/pages/goods_details/index?id=${item.id}`
  626. })
  627. })
  628. })
  629. },
  630. // 微信分享;
  631. setOpenShare: function() {
  632. let that = this;
  633. getShare().then(res => {
  634. let data = res.data;
  635. this.shareInfo = data;
  636. // #ifdef H5
  637. let url = location.href;
  638. if (this.$store.state.app.uid) {
  639. url = url.indexOf('?') === -1 ? url + '?spread=' + this.$store.state.app.uid : url +
  640. '&spread=' + this.$store.state.app.uid;
  641. }
  642. if (that.$wechat.isWeixin()) {
  643. let configAppMessage = {
  644. desc: data.synopsis,
  645. title: data.title,
  646. link: url,
  647. imgUrl: data.img
  648. };
  649. that.$wechat.wechatEvevt(['updateAppMessageShareData', 'updateTimelineShareData'],
  650. configAppMessage);
  651. }
  652. // #endif
  653. });
  654. }
  655. },
  656. onReachBottom: function() {
  657. // if (this.isSortType == 0) {
  658. // // this.getGroomList();
  659. // } else {
  660. // this.getGoodsList();
  661. // }
  662. },
  663. onPageScroll(e) {
  664. if (this.headerSerch.default.isShow.val) {
  665. // if (this.domOffsetTop == 50) return
  666. if (e.scrollTop > this.isTop) {
  667. this.isFixed = true;
  668. }
  669. if (e.scrollTop < this.isTop) {
  670. this.$nextTick(() => {
  671. this.isFixed = false;
  672. });
  673. }
  674. } else {
  675. this.isFixed = false
  676. }
  677. },
  678. };
  679. </script>
  680. <style lang="scss" scoped>
  681. page {
  682. // background: linear-gradient(180deg, #fff, #fff 20%, #f5f5f5);
  683. // overflow-x: hidden;
  684. // overflow-y: scroll;
  685. // height: max-content;
  686. }
  687. .bac-col {
  688. width: 100%;
  689. height: 300rpx;
  690. position: absolute;
  691. background-image: linear-gradient(135deg, #F97794 10%, #623AA2 100%);
  692. top: 0;
  693. background: linear-gradient(90deg, #F62C2C 0%, #F96E29 100%);
  694. }
  695. .swiperCon {
  696. margin: 20rpx 0 !important;
  697. /* #ifdef MP */
  698. /deep/.swiperBg {
  699. margin: 20rpx 0 !important;
  700. }
  701. /* #endif */
  702. /deep/.swiper {
  703. swiper,
  704. .swiper-item,
  705. image {
  706. height: 190rpx !important;
  707. }
  708. }
  709. }
  710. .site-config {
  711. margin: 40rpx 0;
  712. font-size: 24rpx;
  713. text-align: center;
  714. color: #666;
  715. &.fixed {
  716. position: fixed;
  717. bottom: 69px;
  718. left: 0;
  719. width: 100%;
  720. }
  721. }
  722. /* #ifdef MP */
  723. .indexTip {
  724. position: fixed;
  725. right: 42rpx;
  726. z-index: 10000;
  727. .tip {
  728. width: 400rpx;
  729. border-radius: 6rpx;
  730. background-color: #fff;
  731. padding: 15rpx 22rpx;
  732. position: relative;
  733. &::before {
  734. content: "";
  735. width: 0;
  736. height: 0;
  737. border-left: 15rpx solid transparent;
  738. border-right: 15rpx solid transparent;
  739. border-bottom: 17rpx solid #fff;
  740. position: absolute;
  741. top: -14rpx;
  742. right: 95rpx;
  743. }
  744. }
  745. .text {
  746. font-size: 22rpx;
  747. color: #333;
  748. width: 320rpx;
  749. image {
  750. width: 30rpx;
  751. height: 16rpx;
  752. display: inline-block;
  753. }
  754. }
  755. .iconfont {
  756. color: #cdcdcd;
  757. font-size: 32rpx;
  758. }
  759. }
  760. /* #endif */
  761. /* #ifdef H5 */
  762. .follow {
  763. position: fixed;
  764. top: 0;
  765. left: 0;
  766. width: 100%;
  767. background-color: rgba(0, 0, 0, 0.36);
  768. height: 80rpx;
  769. font-size: 28rpx;
  770. color: #fff;
  771. padding: 0 30rpx;
  772. z-index: 100000;
  773. .iconfont {
  774. font-size: 30rpx;
  775. margin-left: 29rpx;
  776. }
  777. .bnt {
  778. width: 160rpx;
  779. height: 50rpx;
  780. background-color: #E93323;
  781. border-radius: 25rpx;
  782. font-size: 24rpx;
  783. text-align: center;
  784. line-height: 50rpx;
  785. }
  786. }
  787. .followCode {
  788. .mask {
  789. z-index: 10000;
  790. }
  791. .pictrue {
  792. width: 500rpx;
  793. height: 720rpx;
  794. border-radius: 12px;
  795. left: 50%;
  796. top: 50%;
  797. margin-left: -250rpx;
  798. margin-top: -360rpx;
  799. position: fixed;
  800. z-index: 10001;
  801. img {
  802. width: 100%;
  803. height: 100%;
  804. }
  805. }
  806. }
  807. /* #endif */
  808. .privacy-wrapper {
  809. z-index: 999;
  810. position: fixed;
  811. left: 0;
  812. top: 0;
  813. width: 100%;
  814. height: 100%;
  815. background: #7F7F7F;
  816. .privacy-box {
  817. position: absolute;
  818. left: 50%;
  819. top: 50%;
  820. transform: translate(-50%, -50%);
  821. width: 560rpx;
  822. padding: 50rpx 45rpx 0;
  823. background: #fff;
  824. border-radius: 20rpx;
  825. .title {
  826. text-align: center;
  827. font-size: 32rpx;
  828. text-align: center;
  829. color: #333;
  830. font-weight: 700;
  831. }
  832. .content {
  833. margin-top: 20rpx;
  834. line-height: 1.5;
  835. font-size: 26rpx;
  836. color: #666;
  837. navigator {
  838. display: inline-block;
  839. color: #E93323;
  840. }
  841. }
  842. .btn-box {
  843. margin-top: 40rpx;
  844. text-align: center;
  845. font-size: 30rpx;
  846. .btn-item {
  847. height: 82rpx;
  848. line-height: 82rpx;
  849. background: linear-gradient(90deg, #F67A38 0%, #F11B09 100%);
  850. color: #fff;
  851. border-radius: 41rpx;
  852. }
  853. .btn {
  854. padding: 30rpx 0;
  855. }
  856. }
  857. }
  858. }
  859. .sort-product {
  860. margin: 20rpx;
  861. }
  862. .empty-box {
  863. text-align: center;
  864. padding: 150rpx 0;
  865. image {
  866. width: 410rpx;
  867. height: 336rpx;
  868. }
  869. }
  870. .nothing {
  871. min-height: 800rpx;
  872. }
  873. .product-list {
  874. display: flex;
  875. flex-wrap: wrap;
  876. justify-content: space-between;
  877. margin-top: 0rpx;
  878. padding: 0 20rpx;
  879. .product-item {
  880. position: relative;
  881. width: 324rpx;
  882. background: #fff;
  883. border-radius: 10rpx;
  884. margin-bottom: 20rpx;
  885. image {
  886. width: 100%;
  887. height: 344rpx;
  888. border-radius: 10rpx 10rpx 0 0;
  889. }
  890. .info {
  891. padding: 14rpx 16rpx;
  892. .title {
  893. font-size: 28rpx;
  894. }
  895. .price-box {
  896. font-size: 34rpx;
  897. font-weight: 700;
  898. margin-top: 8px;
  899. color: #fc4141;
  900. text {
  901. font-size: 26rpx;
  902. }
  903. }
  904. }
  905. }
  906. }
  907. .sticky-box {
  908. // /* #ifndef APP-PLUS-NVUE */
  909. // display: flex;
  910. // position: -webkit-sticky;
  911. // /* #endif */
  912. // position: sticky;
  913. // /* #ifdef H5*/
  914. // top: var(--window-top);
  915. // /* #endif */
  916. // z-index: 99;
  917. // flex-direction: row;
  918. // margin: 0px;
  919. // background: #f5f5f5;
  920. // padding: 30rpx 0;
  921. // /* #ifdef MP || APP-PLUS*/
  922. // //top: 110rpx;
  923. // /* #endif
  924. /* #ifndef H5 */
  925. display: flex;
  926. position: -webkit-sticky;
  927. overflow-x: scroll;
  928. /* #endif */
  929. position: sticky;
  930. z-index: 998;
  931. flex-direction: row;
  932. margin: 0px;
  933. background: #f5f5f5;
  934. padding: 15rpx 0 10rpx 0;
  935. /* #ifdef MP || APP-PLUS*/
  936. //top: 110rpx;
  937. /* #endif */
  938. // overflow-x: scroll;
  939. }
  940. </style>