index.vue 25 KB

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