index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395
  1. <template>
  2. <view>
  3. <view class="page-index" :class="{'bgf':navIndex >0}">
  4. <!-- #ifdef H5||APP||MP-WEIXIN -->
  5. <view class="header">
  6. <view class="serch-wrapper flex">
  7. <view class="logo">
  8. <image :src="logoUrl" mode=""></image>
  9. </view>
  10. <navigator url="/pages/goods_search/index" class="input" hover-class="none"><text
  11. class="iconfont icon-xiazai5"></text>
  12. 搜索商品</navigator>
  13. </view>
  14. </view>
  15. <!-- #endif -->
  16. <!-- 首页展示 -->
  17. <view class="page_content" :style="'margin-top:'+(marTop)+'px;'" v-if="navIndex == 0">
  18. <view class="mp-bg"></view>
  19. <!-- banner -->
  20. <view class="swiper" v-if="imgUrls.length">
  21. <swiper indicator-dots="true" :autoplay="true" :circular="circular" :interval="interval"
  22. :duration="duration" indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
  23. <block v-for="(item,index) in imgUrls" :key="index">
  24. <swiper-item>
  25. <navigator :url='item.url' class='slide-navigator acea-row row-between-wrapper'
  26. hover-class='none'>
  27. <image :src="item.pic" class="slide-image" lazy-load></image>
  28. </navigator>
  29. </swiper-item>
  30. </block>
  31. </swiper>
  32. </view>
  33. <!-- 新闻简报 -->
  34. <!-- <view class='notice acea-row row-middle row-between' v-if="roll.length">
  35. <view class="pic">
  36. <image src="/static/images/xinjian.png"></image>
  37. </view>
  38. <text class='line'>|</text>
  39. <view class='swipers'>
  40. <swiper :indicator-dots="indicatorDots" :autoplay="autoplay" interval="2500" duration="500"
  41. vertical="true" circular="true">
  42. <block v-for="(item,index) in roll" :key='index'>
  43. <swiper-item>
  44. <navigator class='item' :url='item.url' hover-class='none'>
  45. <view class='line1'>{{item.info}}</view>
  46. </navigator>
  47. </swiper-item>
  48. </block>
  49. </swiper>
  50. </view>
  51. <view class="iconfont icon-xiangyou"></view>
  52. </view> -->
  53. <!-- menu -->
  54. <!-- <view class='nav acea-row' v-if="menus.length">
  55. <block v-for="(item,index) in menus" :key="index">
  56. <navigator class='item' v-if="item.show == '1'" :url='item.url' open-type='switchTab'
  57. hover-class='none'>
  58. <view class='pictrue'>
  59. <image :src='item.pic'></image>
  60. </view>
  61. <view class="menu-txt">{{item.name}}</view>
  62. </navigator>
  63. <navigator class='item' v-else :url='item.url' hover-class='none'>
  64. <view class='pictrue'>
  65. <image :src='item.pic'></image>
  66. </view>
  67. <view class="menu-txt">{{item.name}}</view>
  68. </navigator>
  69. </block>
  70. </view> -->
  71. <!-- 优惠券 -->
  72. <!-- <view class="couponIndex" v-if="couponList.length>0">
  73. <view class="acea-row" style="height: 100%;">
  74. <view class="titBox">
  75. <view class="tit1">领取优惠券</view>
  76. <view class="tit2">福利大礼包,省了又省</view>
  77. <navigator class='item' url='/pages/users/user_get_coupon/index' hover-class='none'>
  78. <view class="tit3">查看全部 <text class="iconfont icon-xiangyou"></text></view>
  79. </navigator>
  80. </view>
  81. <view class="listBox acea-row">
  82. <view class="list" :class='item.isUse ? "listHui" : "listActive" '
  83. v-for="(item, index) in couponList.slice(0,2)" :key="index">
  84. <view class="tit line1" :class='item.isUse ? "pricehui" : "titActive" '>{{item.name}}
  85. </view>
  86. <view class="price" :class='item.isUse ? "pricehui" : "icon-color" '>
  87. {{item.money?Number(item.money):''}}<text class="yuan">元</text>
  88. </view>
  89. <view class="ling" v-if="!item.isUse" :class='item.isUse ? "pricehui" : "icon-color" '
  90. @click="getCoupon(item.id,index)">领取</view>
  91. <view class="ling" v-else :class='item.isUse ? "pricehui fonthui" : "icon-color" '>已领取
  92. </view>
  93. <view class="priceM">满{{item.minPrice?Number(item.minPrice):''}}元可用</view>
  94. </view>
  95. </view>
  96. </view>
  97. </view> -->
  98. <!-- 活动-->
  99. <!-- <a_seckill></a_seckill>
  100. <b_combination></b_combination>
  101. <c_bargain></c_bargain> -->
  102. <!-- 首页推荐 -->
  103. <!-- :class="iSshowH?'on':''" -->
  104. <view class="sticky-box" :style="'top:'+(marTop)+'px;'">
  105. <scroll-view class="scroll-view_H" style="width: 100%;" scroll-x="true" scroll-with-animation
  106. :scroll-left="tabsScrollLeft" @scroll="scroll">
  107. <view class="tab nav-bd" id="tab_list">
  108. <view id="tab_item" :class="{ 'active': listActive == index}" class="item"
  109. v-for="(item, index) in explosiveMoney" :key="index" @click="ProductNavTab(item,index)">
  110. <view class="txt">{{item.name}}</view>
  111. <view class="label">{{item.info}}</view>
  112. </view>
  113. </view>
  114. </scroll-view>
  115. </view>
  116. <!-- 首发新品 -->
  117. <view class="index-product-wrapper" :class="iSshowH?'on':''">
  118. <view class="list-box animated" :class='tempArr.length > 0?"fadeIn on":""'>
  119. <view class="item" v-for="(item,index) in tempArr" :key="index" @click="goDetail(item)">
  120. <view class="pictrue">
  121. <span class="pictrue_log pictrue_log_class"
  122. v-if="item.activityH5 && item.activityH5.type === '1'">秒杀</span>
  123. <span class="pictrue_log pictrue_log_class"
  124. v-if="item.activityH5 && item.activityH5.type === '2'">砍价</span>
  125. <span class="pictrue_log pictrue_log_class"
  126. v-if="item.activityH5 && item.activityH5.type === '3'">拼团</span>
  127. <image :src="item.image" mode=""></image>
  128. </view>
  129. <view class="text-info">
  130. <view class="title line1">{{item.storeName}}</view>
  131. <view class="old-price"><text>¥{{item.otPrice}}</text></view>
  132. <view class="price">
  133. <text>¥</text>{{item.price}}
  134. <view class="txt" v-if="item.checkCoupon">券</view>
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. <view class='loadingicon acea-row row-center-wrapper' v-if="goodScroll">
  140. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>
  141. </view>
  142. <view class="mores-txt flex" v-if="!goodScroll">
  143. <text>我是有底线的</text>
  144. </view>
  145. </view>
  146. </view>
  147. </view>
  148. </view>
  149. </template>
  150. <script>
  151. import Auth from '@/libs/wechat';
  152. import Cache from '../../utils/cache';
  153. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  154. let app = getApp();
  155. import {
  156. getIndexData,
  157. getCoupons,
  158. setCouponReceive
  159. } from '@/api/api.js';
  160. // #ifdef MP-WEIXIN
  161. import {
  162. getTemlIds
  163. } from '@/api/api.js';
  164. // import {
  165. // SUBSCRIBE_MESSAGE,
  166. // TIPS_KEY
  167. // } from '@/config/cache';
  168. // #endif
  169. // #ifdef H5
  170. import {
  171. follow
  172. } from '@/api/public.js';
  173. // #endif
  174. import {
  175. getShare
  176. } from '@/api/public.js';
  177. import a_seckill from './components/a_seckill';
  178. import b_combination from './components/b_combination';
  179. import c_bargain from './components/c_bargain';
  180. import goodList from '@/components/goodList';
  181. import promotionGood from '@/components/promotionGood';
  182. import couponWindow from '@/components/couponWindow';
  183. import ClipboardJS from "@/plugin/clipboard/clipboard.js";
  184. import {
  185. goShopDetail
  186. } from '@/libs/order.js'
  187. import {
  188. mapGetters
  189. } from "vuex";
  190. import tabNav from '@/components/tabNav.vue'
  191. import countDown from '@/components/countDown';
  192. import {
  193. getCategoryList,
  194. getProductslist,
  195. getProductHot,
  196. getGroomList
  197. } from '@/api/store.js';
  198. // import {
  199. // setVisit
  200. // } from '@/api/user.js'
  201. import recommend from '@/components/recommend';
  202. // #ifdef MP
  203. import authorize from '@/components/Authorize';
  204. // #endif
  205. import {
  206. silenceBindingSpread
  207. } from '@/utils';
  208. // #ifndef MP
  209. import {
  210. kefuConfig
  211. } from "@/api/public";
  212. import {
  213. getWechatConfig
  214. } from "@/api/public";
  215. // #endif
  216. import Loading from '@/components/Loading/index.vue';
  217. const arrTemp = ["beforePay", "afterPay", "refundApply", "beforeRecharge", "createBargain", "pink"];
  218. export default {
  219. computed: mapGetters(['isLogin', 'uid']),
  220. components: {
  221. tabNav,
  222. goodList,
  223. promotionGood,
  224. couponWindow,
  225. countDown,
  226. a_seckill,
  227. b_combination,
  228. c_bargain,
  229. recommend,
  230. // #ifdef MP
  231. authorize,
  232. // #endif
  233. Loading
  234. },
  235. data() {
  236. return {
  237. pageHeight: 0,
  238. loaded: false,
  239. loading: false,
  240. isAuto: false, //没有授权的不会自动授权
  241. isShowAuth: false, //是否隐藏授权
  242. statusBarHeight: statusBarHeight,
  243. navIndex: 0,
  244. navTop: [],
  245. followUrl: "",
  246. followHid: true,
  247. followCode: false,
  248. logoUrl: "",
  249. imgUrls: [],
  250. itemNew: [],
  251. menus: [],
  252. bastInfo: '',
  253. fastInfo: '',
  254. fastList: [],
  255. firstInfo: '',
  256. salesInfo: '',
  257. indicatorDots: false,
  258. circular: true,
  259. autoplay: true,
  260. interval: 3000,
  261. duration: 500,
  262. window: false,
  263. iShidden: false,
  264. navH: "",
  265. newGoodsBananr: '',
  266. couponList: [],
  267. liveList: [],
  268. hotList: [{
  269. pic: '/static/images/hot_001.png'
  270. }, {
  271. pic: '/static/images/hot_002.png'
  272. }, {
  273. pic: '/static/images/hot_003.png'
  274. }],
  275. ProductNavindex: 0,
  276. marTop: 0,
  277. childID: 0,
  278. loadend: false,
  279. loadTitle: '加载更多',
  280. sortProduct: [],
  281. where: {
  282. cid: 0,
  283. page: 1,
  284. limit: 10,
  285. },
  286. is_switch: true,
  287. hotPage: 1,
  288. hotLimit: 10,
  289. hotScroll: false,
  290. explosiveMoney: [],
  291. prodeuctTop: 0,
  292. searchH: 0,
  293. isFixed: false,
  294. goodType: 0, //精品推荐Type
  295. goodScroll: true, //精品推荐开关
  296. params: { //精品推荐分页
  297. page: 1,
  298. limit: 10,
  299. },
  300. tempArr: [], //精品推荐临时数组
  301. roll: [], // 新闻简报
  302. site_name: '', //首页title
  303. iSshowH: false,
  304. configApi: {}, //分享类容配置
  305. spikeList: [], // 秒杀
  306. point: '',
  307. privacyStatus: false, // 隐私政策是否同意过
  308. tabsScrollLeft: 0, // tabs当前偏移量
  309. scrollLeft: 0,
  310. lineColor: 'red',
  311. lineStyle: {}, // 下划线位置--动态甲酸
  312. listActive: 0, // 当前选中项
  313. duration: 0.2 // 下划线动画时长
  314. }
  315. },
  316. watch: {
  317. ProductNavindex(newVal) { // 监听当前选中项
  318. this.setTabList()
  319. },
  320. listActive(newVal) { // 监听当前选中项
  321. this.setTabList()
  322. }
  323. },
  324. mounted() {
  325. this.setTabList()
  326. },
  327. onLoad() {
  328. var that = this;
  329. // 获取系统信息
  330. uni.getSystemInfo({
  331. success(res) {
  332. that.$store.commit("SYSTEM_PLATFORM", res.platform);
  333. }
  334. });
  335. uni.getLocation({
  336. type: 'gcj02',
  337. altitude: true,
  338. geocode: true,
  339. success: function(res) {
  340. try {
  341. uni.setStorageSync('user_latitude', res.latitude);
  342. uni.setStorageSync('user_longitude', res.longitude);
  343. } catch {}
  344. }
  345. });
  346. let self = this
  347. // #ifdef MP
  348. // 获取小程序头部高度
  349. this.navH = app.globalData.navHeight;
  350. let info = uni.createSelectorQuery().select(".mp-header");
  351. info.boundingClientRect(function(data) {
  352. self.marTop = data.height
  353. self.poTop = Number(data.height) + 84
  354. }).exec()
  355. // #endif
  356. // #ifndef MP
  357. this.navH = 0;
  358. // #endif
  359. this.isLogin && silenceBindingSpread();
  360. // Promise.all([this.getAllCategory(), this.getIndexConfig()
  361. // // , this.setVisit()
  362. // ]);
  363. this.getIndexConfig();
  364. // #ifdef MP
  365. this.getTemlIds()
  366. // #endif
  367. },
  368. onShow() {
  369. let self = this
  370. uni.setNavigationBarTitle({
  371. title: self.site_name
  372. })
  373. },
  374. methods: {
  375. getCoupon: function(id, index) {
  376. let that = this;
  377. //领取优惠券
  378. setCouponReceive(id).then(function(res) {
  379. that.$set(that.couponList[index], 'isUse', true);
  380. that.$util.Tips({
  381. title: '领取成功'
  382. });
  383. }, function(res) {
  384. return that.$util.Tips({
  385. title: res
  386. });
  387. })
  388. },
  389. clickSort(index) {
  390. this.listActive = index
  391. },
  392. // scroll-view滑动事件
  393. scroll(e) {
  394. this.scrollLeft = e.detail.scrollLeft;
  395. },
  396. setTabList() {
  397. this.$nextTick(() => {
  398. //this.setLine()
  399. this.scrollIntoView()
  400. })
  401. },
  402. // 计算tabs位置
  403. scrollIntoView() { // item滚动
  404. let lineLeft = 0;
  405. this.getElementData('#tab_list', (data) => {
  406. let list = data[0]
  407. this.getElementData(`#tab_item`, (data) => {
  408. let el = data[this.listActive]
  409. lineLeft = el.width / 2 + (-list.left) + el.left - list.width / 2 - this.scrollLeft
  410. this.tabsScrollLeft = this.scrollLeft + lineLeft
  411. })
  412. })
  413. },
  414. // 计算下划线位置
  415. setLine() {
  416. let lineWidth = 0,
  417. lineLeft = 0
  418. this.getElementData(`#tab_item`, (data) => {
  419. let el = data[this.listActive]
  420. lineWidth = el.width / 2
  421. // lineLeft = el.width * (this.currentIndex + 0.5) // 此种只能针对每个item长度一致的
  422. lineLeft = el.width / 2 + (-data[0].left) + el.left
  423. this.lineStyle = {
  424. width: `${lineWidth}px`,
  425. transform: `translateX(${lineLeft}px) translateX(-50%)`,
  426. transitionDuration: `${this.duration}s`
  427. };
  428. })
  429. },
  430. getElementData(el, callback) {
  431. uni.createSelectorQuery().in(this).selectAll(el).boundingClientRect().exec((data) => {
  432. callback(data[0]);
  433. });
  434. },
  435. xieyiApp() {
  436. // uni.navigateTo({
  437. // url: '/pages/users/web_page/index?webUel=https://admin.java.crmeb.net/useragreement/xieyi.html&title=协议内容'
  438. // })
  439. },
  440. // #ifdef MP
  441. getTemlIds() {
  442. for (var i in arrTemp) {
  443. this.getTem(arrTemp[i]);
  444. }
  445. },
  446. getTem(data) {
  447. getTemlIds({
  448. type: data
  449. }).then(res => {
  450. if (res.data) {
  451. let arr = res.data.map((item) => {
  452. return item.tempId
  453. })
  454. wx.setStorageSync('tempID' + data, arr);
  455. }
  456. })
  457. },
  458. // #endif
  459. // 首页数据
  460. getIndexConfig: function() {
  461. let that = this;
  462. getIndexData().then(res => {
  463. uni.setNavigationBarTitle({
  464. title: '首页'
  465. })
  466. that.$set(that, "logoUrl", res.data.logoUrl);
  467. that.$set(that, "site_name", '首页');
  468. that.$set(that, "imgUrls", res.data.banner);
  469. that.$set(that, "menus", res.data.menus);
  470. that.$set(that, "roll", res.data.roll ? res.data.roll : []);
  471. // #ifdef H5
  472. that.$store.commit("SET_CHATURL", res.data.yzfUrl);
  473. Cache.set('chatUrl', res.data.yzfUrl);
  474. // #endif
  475. that.$set(that, "explosiveMoney", res.data.explosiveMoney);
  476. that.goodType = res.data.explosiveMoney[0].type
  477. this.getGroomList();
  478. this.shareApi();
  479. this.getcouponList();
  480. // #ifdef H5
  481. // that.subscribe = res.data.subscribe;
  482. // #endif
  483. })
  484. },
  485. getcouponList() {
  486. let that = this;
  487. getCoupons({
  488. page: 1,
  489. limit: 6
  490. }).then(res => {
  491. that.$set(that, "couponList", res.data);
  492. // 小程序判断用户是否授权;
  493. // #ifdef MP
  494. uni.getSetting({
  495. success(res) {
  496. if (!res.authSetting['scope.userInfo']) {
  497. that.window = that.couponList.length ? true : false;
  498. } else {
  499. that.window = false;
  500. that.iShidden = true;
  501. }
  502. }
  503. });
  504. // #endif
  505. // #ifndef MP
  506. if (that.isLogin) {
  507. that.window = false;
  508. } else {
  509. that.window = res.data.length ? true : false;
  510. }
  511. // #endif
  512. }).catch(err => {
  513. return this.$util.Tips({
  514. title: err
  515. });
  516. });
  517. },
  518. shareApi: function() {
  519. getShare().then(res => {
  520. this.$set(this, 'configApi', res.data);
  521. // #ifdef H5
  522. this.setOpenShare(res.data);
  523. // #endif
  524. })
  525. },
  526. getChatUrL() {
  527. kefuConfig().then(res => {
  528. let data = res.data;
  529. this.$store.commit("SET_CHATURL", data.yzfUrl);
  530. Cache.set('chatUrl', data.yzfUrl);
  531. })
  532. },
  533. // 微信分享;
  534. setOpenShare: function(data) {
  535. let that = this;
  536. if (that.$wechat.isWeixin()) {
  537. let configAppMessage = {
  538. desc: data.synopsis,
  539. title: data.title,
  540. link: location.href,
  541. imgUrl: data.img
  542. };
  543. that.$wechat.wechatEvevt(["updateAppMessageShareData", "updateTimelineShareData"],
  544. configAppMessage);
  545. }
  546. },
  547. // 授权关闭
  548. authColse: function(e) {
  549. this.isShowAuth = e
  550. },
  551. // 授权回调
  552. onLoadFun() {
  553. },
  554. // 首发新品切换
  555. ProductNavTab(item, index) {
  556. this.listActive = index
  557. this.goodType = item.type
  558. this.listActive = index
  559. this.ProductNavindex = index
  560. this.tempArr = []
  561. this.params.page = 1
  562. this.goodScroll = true
  563. let onloadH = true
  564. this.getGroomList(onloadH)
  565. },
  566. // 首发新品详情
  567. goDetail(item) {
  568. if (item.activityH5 && item.activityH5.type === "2" && !this.isLogin) {
  569. toLogin();
  570. } else {
  571. goShopDetail(item, this.uid).then(res => {
  572. uni.navigateTo({
  573. url: `/pages/goods_details/index?id=${item.id}`
  574. })
  575. })
  576. }
  577. },
  578. // 分类详情
  579. godDetail(item) {
  580. goShopDetail(item, this.uid).then(res => {
  581. uni.navigateTo({
  582. url: `/pages/goods_details/index?id=${item.id}`
  583. })
  584. })
  585. },
  586. // 精品推荐
  587. getGroomList(onloadH) {
  588. this.loading = true
  589. let type = this.goodType;
  590. if (!this.goodScroll) return
  591. if (onloadH) {
  592. this.iSshowH = true
  593. }
  594. getGroomList(type, this.params).then(({
  595. data
  596. }) => {
  597. this.iSshowH = false
  598. this.loading = false
  599. this.goodScroll = data.list.length >= this.params.limit
  600. this.params.page++
  601. this.tempArr = this.tempArr.concat(data.list)
  602. })
  603. },
  604. /**
  605. * 获取我的推荐
  606. */
  607. get_host_product: function() {
  608. let that = this;
  609. that.loading = true;
  610. if (that.hotScroll) return
  611. getProductHot(
  612. that.hotPage,
  613. that.hotLimit,
  614. ).then(res => {
  615. that.hotPage++
  616. that.hotScroll = res.data.list.length < that.hotLimit
  617. that.hostProduct = that.hostProduct.concat(res.data.list)
  618. });
  619. },
  620. },
  621. mounted() {
  622. let self = this
  623. // #ifdef H5
  624. //self.getChatUrL();
  625. // 获取H5 搜索框高度
  626. let appSearchH = uni.createSelectorQuery().select(".serch-wrapper");
  627. appSearchH.boundingClientRect(function(data) {
  628. self.searchH = data.height
  629. }).exec()
  630. // #endif
  631. },
  632. /**
  633. * 用户点击右上角分享
  634. */
  635. // #ifdef MP
  636. onShareAppMessage: function() {
  637. return {
  638. title: this.configApi.title,
  639. imageUrl: this.configApi.img,
  640. desc: this.configApi.synopsis,
  641. path: '/pages/index/index'
  642. };
  643. },
  644. // #endif
  645. onReachBottom() {
  646. if (this.navIndex == 0) {
  647. // 首页加载更多
  648. if (this.params.page != 1) {
  649. this.getGroomList();
  650. }
  651. } else {
  652. // 分类栏目加载更多
  653. if (this.sortProduct.length > 0) {
  654. //this.get_product_list();
  655. } else {
  656. this.get_host_product();
  657. }
  658. }
  659. },
  660. }
  661. </script>
  662. <style>
  663. page {
  664. display: flex;
  665. flex-direction: column;
  666. height: 100%;
  667. /* #ifdef H5 */
  668. background-color: #fff;
  669. /* #endif */
  670. }
  671. </style>
  672. <style lang="scss">
  673. .notice {
  674. width: 100%;
  675. height: 70rpx;
  676. border-radius: 10rpx;
  677. background-color: #fff;
  678. margin-bottom: 25rpx;
  679. line-height: 70rpx;
  680. padding: 0 14rpx;
  681. .line {
  682. color: #CCCCCC;
  683. }
  684. .pic {
  685. width: 130rpx;
  686. height: 36rpx;
  687. image {
  688. width: 100%;
  689. height: 100%;
  690. display: block !important;
  691. }
  692. }
  693. .swipers {
  694. height: 100%;
  695. width: 444rpx;
  696. overflow: hidden;
  697. swiper {
  698. height: 100%;
  699. width: 100%;
  700. overflow: hidden;
  701. font-size: 22rpx;
  702. color: #333333;
  703. }
  704. }
  705. .iconfont {
  706. color: #999999;
  707. font-size: 20rpx;
  708. }
  709. }
  710. .couponIndex {
  711. width: auto;
  712. height: 238rpx;
  713. background-image: url('~@/static/images/yhjsy.png');
  714. background-size: 100% 100%;
  715. padding-left: 42rpx;
  716. margin-bottom: 30rpx;
  717. .titBox {
  718. padding: 47rpx 0;
  719. text-align: center;
  720. height: 100%;
  721. .tit1 {
  722. color: #FFEBD2;
  723. font-size: 34rpx;
  724. font-weight: 600;
  725. }
  726. .tit2 {
  727. color: #FFEBD2;
  728. font-size: 22rpx;
  729. margin: 10rpx 0 26rpx 0;
  730. }
  731. .tit3 {
  732. color: #FFDAAF;
  733. font-size: 24rpx;
  734. .iconfont {
  735. font-size: 20rpx;
  736. }
  737. }
  738. }
  739. .listBox {
  740. padding: 14rpx 0;
  741. .listActive {
  742. background-image: url('~@/static/images/lingyhj.png');
  743. background-size: 100% 100%;
  744. }
  745. .listHui {
  746. background-image: url('~@/static/images/weiling.png');
  747. background-size: 100% 100%;
  748. }
  749. .list {
  750. width: 170rpx;
  751. height: 210rpx;
  752. padding: 16rpx 0;
  753. text-align: center;
  754. margin-left: 24rpx;
  755. .tit {
  756. font-size: 18rpx;
  757. padding: 0 26rpx;
  758. }
  759. .titActive {
  760. color: #C99959;
  761. }
  762. .price {
  763. font-size: 46rpx;
  764. font-weight: 900;
  765. margin-top: 4rpx;
  766. }
  767. .pricehui {
  768. color: #B2B2B2;
  769. }
  770. .fonthui {
  771. background-color: #F5F5F5 !important;
  772. }
  773. .yuan {
  774. font-size: 24rpx;
  775. }
  776. .ling {
  777. font-size: 24rpx;
  778. margin-top: 9.5rpx;
  779. width: 102rpx;
  780. height: 36rpx;
  781. line-height: 36rpx;
  782. background-color: #FFE5C7;
  783. border-radius: 28rpx;
  784. margin: auto;
  785. }
  786. .priceM {
  787. color: #FFDAAF;
  788. font-size: 22rpx;
  789. margin-top: 14rpx;
  790. }
  791. }
  792. }
  793. }
  794. .sticky-box {
  795. /* #ifndef APP-PLUS-NVUE */
  796. display: flex;
  797. position: -webkit-sticky;
  798. /* #endif */
  799. position: sticky;
  800. /* #ifdef H5*/
  801. top: var(--window-top);
  802. /* #endif */
  803. z-index: 99;
  804. flex-direction: row;
  805. margin: 0px;
  806. background: #f5f5f5;
  807. padding: 30rpx 0;
  808. }
  809. .listAll {
  810. width: 20%;
  811. text-indent: 62rpx;
  812. font-size: 30rpx;
  813. border-left: 1px #eee solid;
  814. margin: 1% 0;
  815. padding: 5rpx;
  816. position: relative;
  817. image {
  818. position: absolute;
  819. left: 20rpx;
  820. top: 8rpx;
  821. }
  822. }
  823. .tab {
  824. position: relative;
  825. display: flex;
  826. font-size: 28rpx;
  827. white-space: nowrap;
  828. &__item {
  829. flex: 1;
  830. padding: 0 20rpx;
  831. text-align: center;
  832. height: 60rpx;
  833. line-height: 60rpx;
  834. color: #666;
  835. &.active {
  836. color: #09C2C9;
  837. }
  838. }
  839. }
  840. .tab__line {
  841. display: block;
  842. height: 6rpx;
  843. position: absolute;
  844. bottom: 0;
  845. left: 0;
  846. z-index: 1;
  847. border-radius: 3rpx;
  848. position: relative;
  849. background: #2FC6CD;
  850. }
  851. .scroll-view_H {
  852. /* 文本不会换行,文本会在在同一行上继续,直到遇到 <br> 标签为止。 */
  853. white-space: nowrap;
  854. width: 100%;
  855. }
  856. .privacy-wrapper {
  857. z-index: 999;
  858. position: fixed;
  859. left: 0;
  860. top: 0;
  861. width: 100%;
  862. height: 100%;
  863. background: #7F7F7F;
  864. .privacy-box {
  865. position: absolute;
  866. left: 50%;
  867. top: 50%;
  868. transform: translate(-50%, -50%);
  869. width: 560rpx;
  870. padding: 50rpx 45rpx 0;
  871. background: #fff;
  872. border-radius: 20rpx;
  873. .title {
  874. text-align: center;
  875. font-size: 32rpx;
  876. text-align: center;
  877. color: #333;
  878. font-weight: 700;
  879. }
  880. .content {
  881. margin-top: 20rpx;
  882. line-height: 1.5;
  883. font-size: 26rpx;
  884. color: #666;
  885. text-indent: 54rpx;
  886. i {
  887. font-style: normal;
  888. color: $theme-color;
  889. }
  890. }
  891. .btn-box {
  892. margin-top: 40rpx;
  893. text-align: center;
  894. font-size: 30rpx;
  895. .btn-item {
  896. height: 82rpx;
  897. line-height: 82rpx;
  898. background: linear-gradient(90deg, #F67A38 0%, #F11B09 100%);
  899. color: #fff;
  900. border-radius: 41rpx;
  901. }
  902. .btn {
  903. padding: 30rpx 0;
  904. }
  905. }
  906. }
  907. }
  908. .page-index {
  909. display: flex;
  910. flex-direction: column;
  911. min-height: 100%;
  912. background: linear-gradient(180deg, #fff 0%, #f5f5f5 100%);
  913. .header {
  914. position: sticky;
  915. top: 0;
  916. z-index: 200000;
  917. width: 100%;
  918. background-color: $theme-color;
  919. padding: 28rpx 30rpx;
  920. .serch-wrapper {
  921. margin-top: var(--status-bar-height);
  922. align-items: center;
  923. /* #ifdef MP-WEIXIN */
  924. width: 75%;
  925. /* #endif */
  926. .logo {
  927. width: 118rpx;
  928. height: 42rpx;
  929. margin-right: 24rpx;
  930. }
  931. image {
  932. width: 118rpx;
  933. height: 42rpx;
  934. }
  935. .input {
  936. display: flex;
  937. align-items: center;
  938. width: 546rpx;
  939. height: 58rpx;
  940. padding: 0 0 0 30rpx;
  941. background: rgba(247, 247, 247, 1);
  942. border: 1px solid rgba(241, 241, 241, 1);
  943. border-radius: 29rpx;
  944. color: #BBBBBB;
  945. font-size: 26rpx;
  946. .iconfont {
  947. margin-right: 20rpx;
  948. font-size: 26rpx;
  949. color: #666666;
  950. }
  951. }
  952. }
  953. .tabNav {
  954. padding-top: 24rpx;
  955. }
  956. }
  957. /* #ifdef MP||APP */
  958. .mp-header {
  959. z-index: 999;
  960. position: fixed;
  961. left: 0;
  962. top: 0;
  963. width: 100%;
  964. /* #ifdef H5||APP */
  965. padding-bottom: 20rpx;
  966. /* #endif */
  967. background-color: $theme-color;
  968. .serch-wrapper {
  969. height: 100%;
  970. align-items: center;
  971. padding: 0 50rpx 0 53rpx;
  972. image {
  973. width: 118rpx;
  974. height: 42rpx;
  975. margin-right: 30rpx;
  976. }
  977. .input {
  978. display: flex;
  979. align-items: center;
  980. /* #ifdef MP||APP */
  981. width: 305rpx;
  982. /* #endif */
  983. height: 50rpx;
  984. padding: 0 0 0 30rpx;
  985. background: rgba(247, 247, 247, 1);
  986. border: 1px solid rgba(241, 241, 241, 1);
  987. border-radius: 29rpx;
  988. color: #BBBBBB;
  989. font-size: 28rpx;
  990. .iconfont {
  991. margin-right: 20rpx;
  992. }
  993. }
  994. }
  995. }
  996. /* #endif */
  997. .page_content {
  998. background-color: #f5f5f5;
  999. /* #ifdef H5 */
  1000. // margin-top: 20rpx !important;
  1001. /* #endif */
  1002. padding: 0 30rpx;
  1003. .swiper {
  1004. position: relative;
  1005. width: 100%;
  1006. height: 280rpx;
  1007. margin: 0 auto;
  1008. border-radius: 10rpx;
  1009. overflow: hidden;
  1010. margin-bottom: 25rpx;
  1011. /* #ifdef MP */
  1012. z-index: 10;
  1013. margin-top: 20rpx;
  1014. /* #endif */
  1015. swiper,
  1016. .swiper-item,
  1017. image {
  1018. width: 100%;
  1019. height: 280rpx;
  1020. border-radius: 10rpx;
  1021. }
  1022. }
  1023. .nav {
  1024. padding-bottom: 26rpx;
  1025. background: #fff;
  1026. opacity: 1;
  1027. border-radius: 14rpx;
  1028. width: 100%;
  1029. margin-bottom: 30rpx;
  1030. .item {
  1031. display: flex;
  1032. flex-direction: column;
  1033. align-items: center;
  1034. justify-content: center;
  1035. width: 20%;
  1036. margin-top: 30rpx;
  1037. image {
  1038. width: 82rpx;
  1039. height: 82rpx;
  1040. }
  1041. }
  1042. }
  1043. .nav-bd {
  1044. display: flex;
  1045. align-items: center;
  1046. justify-content: space-between;
  1047. .item {
  1048. display: flex;
  1049. flex-direction: column;
  1050. align-items: center;
  1051. justify-content: center;
  1052. .txt {
  1053. font-size: 32rpx;
  1054. color: #282828;
  1055. }
  1056. .label {
  1057. display: flex;
  1058. align-items: center;
  1059. justify-content: center;
  1060. width: 124rpx;
  1061. height: 32rpx;
  1062. margin-top: 5rpx;
  1063. font-size: 24rpx;
  1064. color: #999;
  1065. }
  1066. &.active {
  1067. color: $theme-color;
  1068. .txt {
  1069. color: $theme-color;
  1070. }
  1071. .label {
  1072. background: linear-gradient(90deg, $bg-star 0%, $bg-end 100%);
  1073. border-radius: 16rpx;
  1074. color: #fff;
  1075. }
  1076. }
  1077. }
  1078. }
  1079. .index-product-wrapper {
  1080. margin-bottom: 110rpx;
  1081. &.on {
  1082. min-height: 1500rpx;
  1083. }
  1084. .list-box {
  1085. display: flex;
  1086. flex-wrap: wrap;
  1087. justify-content: space-between;
  1088. .item {
  1089. width: 335rpx;
  1090. margin-bottom: 20rpx;
  1091. background-color: #fff;
  1092. border-radius: 10rpx;
  1093. overflow: hidden;
  1094. image {
  1095. width: 100%;
  1096. height: 330rpx;
  1097. }
  1098. .text-info {
  1099. padding: 10rpx 20rpx 15rpx;
  1100. .title {
  1101. color: #222222;
  1102. }
  1103. .old-price {
  1104. margin-top: 8rpx;
  1105. font-size: 26rpx;
  1106. color: #AAAAAA;
  1107. text-decoration: line-through;
  1108. text {
  1109. margin-right: 2px;
  1110. font-size: 20rpx;
  1111. }
  1112. }
  1113. .price {
  1114. display: flex;
  1115. align-items: flex-end;
  1116. color: $theme-color;
  1117. font-size: 34rpx;
  1118. font-weight: 800;
  1119. text {
  1120. padding-bottom: 4rpx;
  1121. font-size: 24rpx;
  1122. font-weight: 800;
  1123. }
  1124. .txt {
  1125. display: flex;
  1126. align-items: center;
  1127. justify-content: center;
  1128. width: 28rpx;
  1129. height: 28rpx;
  1130. margin-left: 15rpx;
  1131. margin-bottom: 10rpx;
  1132. border: 1px solid $theme-color;
  1133. border-radius: 4rpx;
  1134. font-size: 22rpx;
  1135. font-weight: normal;
  1136. }
  1137. }
  1138. }
  1139. }
  1140. &.on {
  1141. display: flex;
  1142. }
  1143. }
  1144. }
  1145. }
  1146. }
  1147. .productList {
  1148. /* #ifdef H5 */
  1149. padding-bottom: 140rpx;
  1150. /* #endif */
  1151. }
  1152. .productList .list {
  1153. padding: 0 20rpx;
  1154. }
  1155. .productList .list.on {
  1156. background-color: #fff;
  1157. border-top: 1px solid #f6f6f6;
  1158. }
  1159. .productList .list .item {
  1160. width: 345rpx;
  1161. margin-top: 20rpx;
  1162. background-color: #fff;
  1163. border-radius: 10rpx;
  1164. }
  1165. .productList .list .item.on {
  1166. width: 100%;
  1167. display: flex;
  1168. border-bottom: 1rpx solid #f6f6f6;
  1169. padding: 30rpx 0;
  1170. margin: 0;
  1171. }
  1172. .productList .list .item .pictrue {
  1173. position: relative;
  1174. width: 100%;
  1175. height: 345rpx;
  1176. }
  1177. .productList .list .item .pictrue.on {
  1178. width: 180rpx;
  1179. height: 180rpx;
  1180. }
  1181. .productList .list .item .pictrue image {
  1182. width: 100%;
  1183. height: 100%;
  1184. border-radius: 20rpx 20rpx 0 0;
  1185. }
  1186. .productList .list .item .pictrue image.on {
  1187. border-radius: 6rpx;
  1188. }
  1189. .productList .list .item .text {
  1190. padding: 20rpx 17rpx 26rpx 17rpx;
  1191. font-size: 30rpx;
  1192. color: #222;
  1193. }
  1194. .productList .list .item .text.on {
  1195. width: 508rpx;
  1196. padding: 0 0 0 22rpx;
  1197. }
  1198. .productList .list .item .text .money {
  1199. font-size: 26rpx;
  1200. font-weight: bold;
  1201. margin-top: 8rpx;
  1202. }
  1203. .productList .list .item .text .money.on {
  1204. margin-top: 50rpx;
  1205. }
  1206. .productList .list .item .text .money .num {
  1207. font-size: 34rpx;
  1208. }
  1209. .productList .list .item .text .vip {
  1210. font-size: 22rpx;
  1211. color: #aaa;
  1212. margin-top: 7rpx;
  1213. }
  1214. .productList .list .item .text .vip.on {
  1215. margin-top: 12rpx;
  1216. }
  1217. .productList .list .item .text .vip .vip-money {
  1218. font-size: 24rpx;
  1219. color: #282828;
  1220. font-weight: bold;
  1221. }
  1222. .productList .list .item .text .vip .vip-money image {
  1223. width: 46rpx;
  1224. height: 21rpx;
  1225. margin-left: 4rpx;
  1226. }
  1227. .pictrue {
  1228. position: relative;
  1229. }
  1230. .fixed {
  1231. z-index: 100;
  1232. position: fixed;
  1233. left: 0;
  1234. top: 0;
  1235. background: linear-gradient(90deg, red 50%, #ff5400 100%);
  1236. }
  1237. .mores-txt {
  1238. width: 100%;
  1239. align-items: center;
  1240. justify-content: center;
  1241. height: 70rpx;
  1242. color: #999;
  1243. font-size: 24rpx;
  1244. .iconfont {
  1245. margin-top: 2rpx;
  1246. font-size: 20rpx;
  1247. }
  1248. }
  1249. .menu-txt {
  1250. font-size: 24rpx;
  1251. color: #454545;
  1252. }
  1253. .mp-bg {
  1254. position: absolute;
  1255. left: 0;
  1256. /* #ifdef H5 */
  1257. top: 98rpx;
  1258. /* #endif */
  1259. width: 100%;
  1260. height: 304rpx;
  1261. background: linear-gradient(180deg, #E93323 0%, #F5F5F5 100%, #751A12 100%);
  1262. // border-radius: 0 0 30rpx 30rpx;
  1263. }
  1264. .stats {
  1265. position: absolute;
  1266. left: 0px;
  1267. top: 0px;
  1268. z-index: 2000000;
  1269. width: 750rpx;
  1270. height: var(--status-bar-height);
  1271. background: #ffffff;
  1272. }
  1273. </style>