index.vue 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256
  1. <template>
  2. <view class="container">
  3. <!-- 小程序头部兼容 -->
  4. <!-- #ifdef MP -->
  5. <view class="input-box flex" @click="clickSearch">
  6. <view class=" input-content flex">
  7. <view class="iconfont iconsearch"></view>
  8. <view class="input"><input type="text" disabled placeholder="搜索关键字"></view>
  9. </view>
  10. </view>
  11. <view class="mp-height"></view>
  12. <!-- #endif -->
  13. <!-- 背景色区域 -->
  14. <view class="bg-contain">
  15. <image src="./contain.png" mode="scaleToFill">
  16. </image>
  17. <!-- 头部轮播 -->
  18. <swiper class="carousel" autoplay="true" duration="400" interval="5000" @change="swiperChange">
  19. <swiper-item v-for="(item,index) in carouselList" class="carousel-item" @click="bannerNavToUrl(item)">
  20. <image src="./lunbo.png" mode="scaleToFill"></image>
  21. </swiper-item>
  22. </swiper>
  23. </view>
  24. <!-- 自定义swiper指示器 -->
  25. <!-- <view class="swiper-dots">
  26. <text class="num">{{ swiperCurrent + 1 }}</text>
  27. <text class="sign">/</text>
  28. <text class="num">{{ swiperLength }}</text>
  29. </view> -->
  30. <!-- 分类 -->
  31. <view class="cate-section">
  32. <view class="cate-item">
  33. <image src="/static/icon/c3.png"></image>
  34. <text>联盟礼包</text>
  35. </view>
  36. <navigator url="/pages/product/groupBooking/index">
  37. <view class="cate-item">
  38. <image src="/static/icon/c5.png"></image>
  39. <text>超值拼团</text>
  40. </view>
  41. </navigator>
  42. <navigator url="/pages/product/seckill">
  43. <view class="cate-item">
  44. <image src="/static/icon/c7.png"></image>
  45. <text>限时秒杀</text>
  46. </view>
  47. </navigator>
  48. <navigator url="/pages/index/sign">
  49. <view class="cate-item">
  50. <image src="/static/icon/c8.png"></image>
  51. <text>每日签到</text>
  52. </view>
  53. </navigator>
  54. </view>
  55. <view class="ad-1"><image src="/static/temp/ad1.jpg" mode="scaleToFill"></image></view>
  56. <!-- 可领取优惠券 -->
  57. <!-- <scroll-view class="coupon-box clamp" :scroll-x="true">
  58. <view v-for="(item, index) in couponArray" :key="item.id" class="coupon-list">
  59. <view class="row flex">
  60. <view class="list-money flex">
  61. <image :src="item.is_use ? '/static/img/img02.png' : '/static/img/img03.png'" mode="scaleToFill"></image>
  62. <view class="list-money-text">
  63. <view class="tit" :class="{ noAction: item.is_use }">
  64. <text>{{ item.coupon_price }}</text>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="list-interval position-relative">
  69. <view class="bottom"></view>
  70. <view class="top"></view>
  71. </view>
  72. <view class="row_list_right">
  73. <view class="right_top"><text class="right_title" :class="{ noAction: item.is_use }">满减券</text></view>
  74. <view class="right_time">
  75. <text>满{{ item.use_min_price }}使用</text>
  76. </view>
  77. </view>
  78. <view class="right_use" :class="{ noAction: item.is_use }" @click="setCoupons(item)">
  79. <text>{{ item.is_use ? '已领取' : '立即领取' }}</text>
  80. </view>
  81. </view>
  82. </view>
  83. </scroll-view> -->
  84. <!-- 秒杀楼层 -->
  85. <seckill></seckill>
  86. <!-- 砍价 -->
  87. <view class="hot-goods">
  88. <view class="hot-headers flex-upDown-center">
  89. <!-- <image class="img" src="../../static/img/img44.png"></image> -->
  90. <view class="hot-title">超值砍价</view>
  91. <view><view class="more" @click.stop="navTo('/pages/activity/goods_bargain/index')">更多</view></view>
  92. </view>
  93. <view class="hot-lists" v-for="(baritem, barindex) in bargainlist" :key="barindex" @click.stop="navToDetailPages(baritem)">
  94. <view class="hot-produce">
  95. <view class="produce-image"><image :src="baritem.image"></image></view>
  96. <view class="produce-content">
  97. <view class="produce-price1 ">
  98. <view class="produce-name line2">{{ baritem.title }}</view>
  99. <!-- <view class="produce-info">
  100. 已抢
  101. <text style="color: #FF383E">{{ baritem.sales }}</text>
  102. 箱/仅剩
  103. <text style="color:#FF383E">{{ baritem.stock }}</text>
  104. </view> -->
  105. <view class="produce-center">
  106. <view class="kanjia_word">
  107. <view class="word-1">原价:¥{{ baritem.price }}</view>
  108. <view class="word-2">
  109. 砍后价
  110. <text style="font-size: 24rpx;">¥</text>
  111. <text style="font-size: 36rpx;">{{ baritem.min_price }}</text>
  112. </view>
  113. </view>
  114. <view
  115. class="kanjia_button flex-center"
  116. @tap.stop="openSubscribe('/pages/activity/goods_bargain_details/index?id=' + baritem.id + '&bargain=' + userInfo.uid)"
  117. >
  118. <view>查看详情</view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. <!-- 拼团楼层 -->
  127. <view class="recommend flex">
  128. <view class="recommend_list" @click="change(ls.id)" v-for="ls in recommend">
  129. <view class="re_title" v-bind:class="{ active_color: ls.id == checkid }">{{ ls.re_title }}</view>
  130. <view class="re_name" v-bind:class="{ active_color: ls.id == checkid }">{{ ls.re_name }}</view>
  131. <image class="selected_icon" v-bind:class="{ active: ls.id == checkid }" src="/static/img/img04.png"></image>
  132. </view>
  133. </view>
  134. <swiper id="list-box" @change="listChange" :style="{ height: swiperHeight + 'px' }" :current="checkid">
  135. <swiper-item>
  136. <!-- <scroll-view scroll-y="true" class="list-box-h"> -->
  137. <view class="guess-section">
  138. <view v-for="(item, index) in bastList" :key="index" class="guess-item" @click="navToDetailPage(item)">
  139. <view class="image-wrapper"><image :src="item.image" mode="scaleToFill"></image></view>
  140. <text class="title clamp margin-c-20">{{ item.store_name }}</text>
  141. <view class="cmy-hr"></view>
  142. <view class="price margin-c-20 flex">
  143. <view>
  144. <text class="font-size-sm ">¥</text>
  145. {{ item.price }}
  146. </view>
  147. <view class="font-size-sm">
  148. <text class="font-color-gray">{{ item.sales }}人购买</text>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. <!-- </scroll-view> -->
  154. </swiper-item>
  155. <swiper-item>
  156. <scroll-view scroll-y="true" class="list-box-h">
  157. <view class="guess-section">
  158. <view v-for="(item, index) in goodsList" :key="index" class="guess-item" @click="navToDetailPage(item)">
  159. <view class="image-wrapper"><image :src="item.image" mode="scaleToFill"></image></view>
  160. <text class="title clamp margin-c-20">{{ item.store_name }}</text>
  161. <view class="cmy-hr"></view>
  162. <view class="price margin-c-20 flex">
  163. <view>
  164. <text class="font-size-sm ">¥</text>
  165. {{ item.price }}
  166. </view>
  167. <view class="font-size-sm">
  168. <text class="font-color-gray">{{ item.sales }}人购买</text>
  169. </view>
  170. </view>
  171. </view>
  172. </view>
  173. </scroll-view>
  174. </swiper-item>
  175. <swiper-item>
  176. <scroll-view scroll-y="true">
  177. <view class="guess-section">
  178. <view v-for="(item, index) in bastBanner" :key="index" class="guess-item" @click="navToDetailPage(item)">
  179. <navigator :url="item.link">
  180. <view class="image-wrappe r"><image :src="item.image" mode="scaleToFill"></image></view>
  181. <text class="title clamp margin-c-20">{{ item.store_name }}</text>
  182. <view class="cmy-hr"></view>
  183. <view class="price margin-c-20 flex">
  184. <view>
  185. <text class="font-size-sm ">¥</text>
  186. {{ item.price }}
  187. </view>
  188. <view class="font-size-sm">
  189. <text class="font-color-gray">库存{{ item.stock + item.unit_name }}</text>
  190. </view>
  191. </view>
  192. </navigator>
  193. </view>
  194. </view>
  195. </scroll-view>
  196. </swiper-item>
  197. </swiper>
  198. <!-- 精品 商品 -->
  199. <view class="f-header m-t">
  200. <view class="f-left-icon"></view>
  201. <view class="tit-box"><text class="tit">精品推荐</text></view>
  202. <navigator url="/pages/product/classify?type=1"><text class="iconfont iconenter">更多</text></navigator>
  203. </view>
  204. <view class="guess-section">
  205. <view v-for="(item, index) in bastList" :key="index" class="guess-item" @click="navToDetailPage(item)">
  206. <view class="image-wrapper"><image :src="item.image" mode="scaleToFill"></image></view>
  207. <text class="title clamp margin-c-20">{{ item.store_name }}</text>
  208. <view class="cmy-hr"></view>
  209. <view class="price margin-c-20 flex">
  210. <view>
  211. <text class="font-size-sm ">¥</text>
  212. {{ item.price }}
  213. </view>
  214. <view class="font-size-sm">
  215. <text class="font-color-gray">{{ item.sales }}人购买</text>
  216. </view>
  217. </view>
  218. </view>
  219. </view>
  220. <!-- 最新 商品 -->
  221. <view class="f-header m-t">
  222. <view class="f-left-icon"></view>
  223. <view class="tit-box"><text class="tit">最新商品</text></view>
  224. <navigator url="/pages/product/classify?type=3"><text class="iconfont iconenter">更多</text></navigator>
  225. </view>
  226. <view class="guess-section">
  227. <view v-for="(item, index) in goodsList" :key="index" class="guess-item" @click="navToDetailPage(item)">
  228. <view class="image-wrapper"><image :src="item.image" mode="scaleToFill"></image></view>
  229. <text class="title clamp margin-c-20">{{ item.store_name }}</text>
  230. <view class="cmy-hr"></view>
  231. <view class="price margin-c-20 flex">
  232. <view>
  233. <text class="font-size-sm ">¥</text>
  234. {{ item.price }}
  235. </view>
  236. <view class="font-size-sm">
  237. <text class="font-color-gray">{{ item.sales }}人购买</text>
  238. </view>
  239. </view>
  240. </view>
  241. </view>
  242. <!-- 促销 商品 -->
  243. <view class="f-header m-t">
  244. <view class="f-left-icon"></view>
  245. <view class="tit-box"><text class="tit">促销商品</text></view>
  246. <navigator url="/pages/product/classify?type=4"><text class="iconfont iconenter">更多</text></navigator>
  247. </view>
  248. <view class="guess-section">
  249. <view v-for="(item, index) in bastBanner" :key="index" class="guess-item" @click="navToDetailPage(item)">
  250. <view class="image-wrapper"><image :src="item.image" mode="scaleToFill"></image></view>
  251. <text class="title clamp margin-c-20">{{ item.store_name }}</text>
  252. <view class="cmy-hr"></view>
  253. <view class="price margin-c-20 flex">
  254. <view>
  255. <text class="font-size-sm ">¥</text>
  256. {{ item.price }}
  257. </view>
  258. <view class="font-size-sm">
  259. <text class="font-color-gray">{{ item.sales }}人购买</text>
  260. </view>
  261. </view>
  262. </view>
  263. </view>
  264. <!-- 会员升级专区 -->
  265. <!-- <view class="f-header m-t">
  266. <view class="f-left-icon"></view>
  267. <view class="tit-box"><text class="tit">会员升级专区</text></view>
  268. <text class="iconfont iconenter">更多</text>
  269. </view> -->
  270. <!-- <view class="uservip flex">
  271. <image @error="onImageError('userServant', 0)" lazy-load :src="userServant[0].image" mode="aspectFill"></image>
  272. <view class="detail">
  273. <view class="title">满园春1999元会员升级礼包</view>
  274. <view class="icon">自营</view>
  275. <view class="flex price-box">
  276. <view class="price">
  277. <text class="font-size-sm">¥</text>
  278. 18888
  279. </view>
  280. <view class="text">115人购买</view>
  281. </view>
  282. </view>
  283. </view> -->
  284. <!-- 精品推荐 -->
  285. <!-- <view class="f-header m-t">
  286. <view class="f-left-icon"></view>
  287. <view class="tit-box"><text class="tit">精品推荐</text></view>
  288. <text class="iconfont iconenter">更多</text>
  289. </view> -->
  290. <!-- <view class="guess-section">
  291. <view v-for="(item, index) in goodsList" :key="index" class="guess-item" @click="navToDetailPage(item)">
  292. <view class="image-wrapper"><image @error="onImageError('goodsList', index)" lazy-load :src="item.image" mode="aspectFill"></image></view>
  293. <text class="title clamp margin-c-20">
  294. <text class="icon">自营</text>
  295. {{ item.title }}
  296. </text>
  297. <view class="hr"></view>
  298. <view class="price margin-c-20 flex">
  299. <view>
  300. <text class="font-size-sm ">¥</text>
  301. {{ item.price }}
  302. </view>
  303. <view class="font-size-sm">
  304. <view class='detail'>
  305. <text class="icon">代理价</text>
  306. <text></text>
  307. </view>
  308. <view class="detail">
  309. <text class="font-color-yellow">会员价</text>
  310. <text class="font-color-yellow">7.5折</text>
  311. </view>
  312. </view>
  313. </view>
  314. <view class="tip">兑换价¥44+44积分</view>
  315. </view>
  316. </view> -->
  317. <view class="Mask" v-show="shareShow">
  318. <image @click="share" src="http://shicai.liuniu946.com/static/img/shareimg4.png"></image>
  319. <view class="Toshare" @click="Toshare"></view>
  320. <view class="Tocancel" @click="Tocancel"></view>
  321. </view>
  322. </view>
  323. </template>
  324. <script>
  325. import seckill from '../../components/seckill/seckill.vue';
  326. import { loadIndexs } from '@/api/index.js';
  327. import { getUserInfo } from '@/api/user.js';
  328. import { setCoupons } from '@/api/functionalUnit.js';
  329. import { getBargainList } from '@/api/product.js';
  330. import { interceptor } from '@/utils/loginUtils';
  331. import { mapState } from 'vuex';
  332. export default {
  333. components: {
  334. seckill
  335. },
  336. watch: {
  337. //自适应swiper高度
  338. checkid(newValue, oldValue) {
  339. let obj = this;
  340. if (newValue == 0) {
  341. let bHeight = Math.ceil(obj.bastList.length / 2);
  342. obj.swiperHeight = Math.ceil(obj.pageProportion * 520 * bHeight);
  343. }
  344. if (newValue == 1) {
  345. let bHeight = Math.ceil(obj.goodsList.length / 2);
  346. obj.swiperHeight = Math.ceil(obj.pageProportion * 520 * bHeight);
  347. }
  348. if (newValue == 2) {
  349. let bHeight = Math.ceil(obj.bastBanner.length / 2);
  350. obj.swiperHeight = Math.ceil(obj.pageProportion * 520 * bHeight);
  351. }
  352. },
  353. // 初次加载页面高度时修改页面高度
  354. bastList(newValue, oldValue) {
  355. let obj = this;
  356. let bHeight = Math.ceil(newValue.length / 2);
  357. obj.$nextTick(function() {
  358. uni.createSelectorQuery()
  359. .select('#list-box')
  360. .fields(
  361. {
  362. size: true
  363. },
  364. function(data) {
  365. obj.pageProportion = data.width / 750;
  366. obj.swiperHeight = Math.ceil(obj.pageProportion * 520 * bHeight);
  367. }
  368. )
  369. .exec();
  370. });
  371. }
  372. },
  373. data() {
  374. return {
  375. shareShow: false, //分享海报
  376. pageProportion: 0, //保存页面基于750宽度的比例
  377. swiperHeight: 0,
  378. checkid: 0,
  379. titleNViewBackground: '',
  380. swiperCurrent: 0,
  381. swiperLength: 0,
  382. bargainlist: [], //砍价商品
  383. carouselList: [{},{},{}], //轮播列表
  384. goodsList: [], //最新商品列表
  385. bastList: [], //精品推荐列表
  386. bastBanner: [], //促销商品列表
  387. menusList: [], //头部菜单
  388. page: 1,
  389. limit: 5,
  390. userServant: [
  391. {
  392. image: ''
  393. }
  394. ], //用户推广服务
  395. couponArray: [], //可领取优惠券
  396. recommend: [
  397. {
  398. id: 0,
  399. re_title: '精选',
  400. re_name: '为你推荐'
  401. },
  402. {
  403. id: 1,
  404. re_title: '最新',
  405. re_name: '最新好货优选'
  406. },
  407. {
  408. id: 2,
  409. re_title: '便宜好货',
  410. re_name: '90天便宜好货'
  411. }
  412. ],
  413. actTime: new Date()
  414. };
  415. },
  416. computed: {
  417. ...mapState(['loginInterceptor']),
  418. ...mapState('user', ['hasLogin','userInfo'])
  419. },
  420. onLoad: function(option) {
  421. // #ifndef MP
  422. if (option.spread) {
  423. // 存储其他邀请人
  424. uni.setStorageSync('spread', option.spread);
  425. }
  426. // #endif
  427. // #ifdef MP
  428. if (option.scene) {
  429. // 存储小程序邀请人
  430. uni.setStorage({
  431. key: 'spread_code',
  432. data: option.scene
  433. });
  434. }
  435. // #endif
  436. },
  437. onShow: function() {
  438. // 判断是否强制登录
  439. if (this.loginInterceptor && !this.hasLogin) {
  440. // 登录拦截
  441. interceptor();
  442. }
  443. this.loadData();
  444. this.getBargainList();
  445. },
  446. //下拉刷新
  447. onPullDownRefresh() {
  448. this.loadData();
  449. },
  450. // #ifndef MP
  451. // 监听导航栏输入框点击事件
  452. onNavigationBarSearchInputClicked(e) {
  453. //跳转到搜索页面
  454. this.clickSearch();
  455. },
  456. //点击导航栏 buttons 时触发
  457. onNavigationBarButtonTap(e) {
  458. const index = e.index;
  459. if (index === 0) {
  460. this.$api.msg('点击了扫描');
  461. } else if (index === 1) {
  462. // #ifdef APP-PLUS
  463. const pages = getCurrentPages();
  464. const page = pages[pages.length - 1];
  465. const currentWebview = page.$getAppWebview();
  466. currentWebview.hideTitleNViewButtonRedDot({
  467. index
  468. });
  469. // #endif
  470. uni.navigateTo({
  471. url: '/pages/user/notice'
  472. });
  473. }
  474. },
  475. // #endif
  476. methods: {
  477. //砍价商品推荐详情页
  478. navToDetailPages(item) {
  479. let id = item.product_id;
  480. //let type = 2;
  481. uni.navigateTo({
  482. url: '/pages/product/product?id=' + id
  483. });
  484. },
  485. openSubscribe: function(e) {
  486. let page = e;
  487. // #ifndef MP
  488. uni.navigateTo({
  489. url: page
  490. });
  491. // #endif
  492. // #ifdef MP
  493. uni.showLoading({
  494. title: '正在加载'
  495. });
  496. openBargainSubscribe()
  497. .then(res => {
  498. uni.hideLoading();
  499. uni.navigateTo({
  500. url: page
  501. });
  502. })
  503. .catch(err => {
  504. uni.hideLoading();
  505. });
  506. // #endif
  507. },
  508. getBargainList() {
  509. let that = this;
  510. getBargainList({
  511. page: that.page,
  512. limit: that.limit
  513. })
  514. .then(function(res) {
  515. that.$set(that, 'bargainlist', res.data.slice(0, 2));
  516. })
  517. .catch(res => {
  518. console.log(res, 'getBargainList');
  519. });
  520. },
  521. Mask() {
  522. this.MaskShow = false;
  523. this.shareShow = true;
  524. uni.setStorage({
  525. key: 'FirstEntry',
  526. data: true,
  527. success: function() {
  528. console.log(uni.getStorageSync('FirstEntry'), 'Mask');
  529. }
  530. });
  531. },
  532. Toshare() {
  533. if (this.userInfo == '') {
  534. getUserInfo({})
  535. .then(({ data }) => {
  536. this.setUserInfo(data);
  537. this.userInfo = data;
  538. })
  539. .catch(e => {});
  540. } else {
  541. this.shareShow = false;
  542. uni.navigateTo({
  543. url: '/pages/user/shareQrCode?spread=' + this.userInfo.uid
  544. });
  545. }
  546. },
  547. Tocancel() {
  548. this.shareShow = false;
  549. },
  550. // 监听切换事件
  551. listChange(e) {
  552. this.checkid = e.detail.current;
  553. },
  554. // 點擊搜索框
  555. clickSearch() {
  556. uni.navigateTo({
  557. url: '/pages/product/search'
  558. });
  559. },
  560. // 点击触发领取优惠券
  561. setCoupons(item) {
  562. // 判断是否已经领取了优惠券
  563. let obj = this;
  564. uni.showModal({
  565. title: '领取提示',
  566. content: '是否领取优惠券',
  567. success(e) {
  568. if (e.confirm) {
  569. setCoupons({ couponId: item.id }).then(e => {
  570. item.is_use = true;
  571. uni.showToast({
  572. title: '领取成功',
  573. type: 'top',
  574. duration: 2000
  575. });
  576. });
  577. }
  578. }
  579. });
  580. },
  581. //商品种类切换
  582. change(item) {
  583. let id = item;
  584. this.checkid = id;
  585. if (this.checkid == 1) {
  586. // console.log(1);
  587. this.detail = this.selected_detail;
  588. } else if (this.checkid == 2) {
  589. // console.log(2);
  590. this.detail = this.new_product;
  591. } else {
  592. this.detail = this.cheap_good;
  593. }
  594. },
  595. // 监听图片加载完成
  596. onImageError(key, index) {
  597. this[key][index].image = '/static/error/errorImage.jpg';
  598. },
  599. // 请求载入数据
  600. async loadData() {loadIndexs({})
  601. .then(({ data }) => {
  602. let goods = data.info;
  603. // this.carouselList = data.banner;
  604. // this.swiperLength = this.carouselList.length;
  605. this.menusList = data.menus;
  606. this.goodsList = goods.firstList; //最新商品
  607. this.bastList = goods.bastList; //精品推荐
  608. this.bastBanner = data.benefit; //促销单品
  609. this.$set(this, 'couponArray', data.couponList); //保存卡包券
  610. uni.stopPullDownRefresh();
  611. })
  612. .catch(e => {
  613. uni.stopPullDownRefresh();
  614. });
  615. },
  616. //轮播图切换修改背景色
  617. swiperChange(e) {
  618. const index = e.detail.current;
  619. this.swiperCurrent = index;
  620. this.titleNViewBackground = this.carouselList[index].background;
  621. },
  622. //详情页
  623. navToDetailPage(item) {
  624. let id = item.id;
  625. uni.navigateTo({
  626. url: '/pages/product/product?id=' + id
  627. });
  628. },
  629. // 轮播图跳转
  630. bannerNavToUrl(item) {
  631. // #ifdef H5
  632. if (item.wap_url.indexOf('http') > 0) {
  633. window.location.href = item.wap_url;
  634. }
  635. // #endif
  636. //测试数据没有写id,用title代替
  637. uni.navigateTo({
  638. url: item.wap_url
  639. });
  640. }
  641. }
  642. };
  643. </script>
  644. <style lang="scss">
  645. .container {
  646. background-color: #D4FDF9;
  647. }
  648. .Mask {
  649. width: 100%;
  650. height: 100vh;
  651. position: fixed;
  652. z-index: 99999;
  653. background-color: rgba(0, 0, 0, 0.7);
  654. top: 0;
  655. image {
  656. width: 100%;
  657. height: 100vh;
  658. }
  659. }
  660. // 热销商品
  661. .hot-goods {
  662. margin: 0 25rpx;
  663. padding: 5rpx 25rpx 30rpx 25rpx;
  664. background-color: #fff;
  665. border-radius: 10rpx;
  666. .hot-headers {
  667. margin: 25rpx 0;
  668. width: 100%;
  669. display: flex;
  670. .img {
  671. width: 32rpx;
  672. height: 32rpx;
  673. margin-right: 10rpx;
  674. }
  675. .hot-title {
  676. font-size: 30rpx;
  677. margin-right: 15rpx;
  678. }
  679. .more {
  680. line-height: 1;
  681. padding: 5rpx 10rpx 5rpx 15rpx;
  682. text-align: center;
  683. font-size: 20rpx;
  684. border-radius: 15rpx;
  685. color: #ffffff;
  686. background: linear-gradient(90deg, rgba(250, 52, 38, 1) 0%, rgba(249, 30, 83, 1) 100%);
  687. image {
  688. width: 20rpx;
  689. height: 20rpx;
  690. }
  691. }
  692. }
  693. .hot-lists {
  694. line-height: 1;
  695. display: flex;
  696. .hot-produce {
  697. width: 100%;
  698. height: 260rpx;
  699. border-top: 1px solid #f0f0f0;
  700. display: flex;
  701. padding-top: 28rpx;
  702. .produce-image {
  703. width: 200rpx;
  704. height: 200rpx;
  705. image {
  706. width: 200rpx;
  707. height: 200rpx;
  708. border: 1px solid #f0f0f0;
  709. }
  710. }
  711. .produce-content {
  712. // flex-direction: column;
  713. margin-left: 30rpx;
  714. height: 200rpx;
  715. position: relative;
  716. width: calc(100% - 200rpx - 30rpx);
  717. .produce-name {
  718. font-size: 28rpx;
  719. font-weight: bold;
  720. line-height: 35rpx;
  721. color: #343434;
  722. }
  723. .produce-info {
  724. font-size: 20rpx;
  725. margin-top: 25rpx;
  726. }
  727. .produce-price {
  728. display: flex;
  729. align-items: flex-end;
  730. color: #ff383e;
  731. font-size: 24rpx;
  732. margin-top: 70rpx;
  733. font-weight: bold;
  734. text {
  735. font-size: 36rpx;
  736. }
  737. .produce-price-1 {
  738. font-size: 22rpx;
  739. font-weight: 500;
  740. text-decoration: line-through;
  741. color: rgba(170, 170, 170, 1);
  742. margin-left: 20rpx;
  743. }
  744. }
  745. .produce-price1 {
  746. height: 100%;
  747. letter-spacing: 3rpx;
  748. color: #ff383e;
  749. font-size: 24rpx;
  750. font-weight: bold;
  751. .produce-center {
  752. width: 100%;
  753. position: absolute;
  754. bottom: 0;
  755. display: flex;
  756. justify-content: space-between;
  757. align-items: center;
  758. .kanjia_word {
  759. .word-1 {
  760. font-size: 22rpx;
  761. color: #666666;
  762. }
  763. .word-2 {
  764. font-size: 28rpx;
  765. color: #ff383e;
  766. margin-top: 10rpx;
  767. }
  768. }
  769. .kanjia_button {
  770. height: 50rpx;
  771. width: 150rpx;
  772. border-radius: 25rpx;
  773. font-size: 26rpx;
  774. font-weight: 500;
  775. color: #ff383e;
  776. border: 1px solid rgba(255, 56, 62, 1);
  777. }
  778. }
  779. }
  780. }
  781. }
  782. }
  783. }
  784. /* #ifdef MP */
  785. .mp-height {
  786. height: 44px;
  787. }
  788. .input-box {
  789. position: fixed;
  790. top: 0;
  791. left: 0;
  792. width: 100%;
  793. padding: 25rpx;
  794. background-color: #ffffff;
  795. z-index: 999;
  796. height: 44px;
  797. .iconsearch {
  798. font-size: 50rpx;
  799. }
  800. .input-content {
  801. border-radius: 99rpx;
  802. flex-grow: 1;
  803. padding: 10rpx 30rpx;
  804. background-color: rgba(231, 231, 231, 0.7);
  805. .input {
  806. flex-grow: 1;
  807. input {
  808. font-size: $font-lg;
  809. }
  810. }
  811. }
  812. .input-button {
  813. padding-left: 20rpx;
  814. font-size: $font-lg;
  815. height: 100%;
  816. }
  817. }
  818. page {
  819. .cate-section {
  820. position: relative;
  821. z-index: 5;
  822. border-radius: 16rpx 16rpx 0 0;
  823. margin-top: -20rpx;
  824. }
  825. }
  826. /* #endif */
  827. .bg-contain {
  828. height: 460rpx;
  829. width: 750rpx;
  830. image {
  831. width: 100%;
  832. height: 100%;
  833. }
  834. }
  835. page {
  836. background: #f7f8f7;
  837. }
  838. .m-t {
  839. margin-top: 16rpx;
  840. }
  841. /* 头部 轮播图 */
  842. .carousel-section {
  843. position: relative;
  844. padding-top: 10px;
  845. overflow: hidden;
  846. .titleNview-placing {
  847. height: var(--status-bar-height);
  848. padding-top: 44px;
  849. box-sizing: content-box;
  850. }
  851. .titleNview-background {
  852. position: absolute;
  853. top: 0;
  854. left: 0;
  855. width: 100%;
  856. height: 426rpx;
  857. transition: 0.4s;
  858. }
  859. .carousel {
  860. width: 100%;
  861. height: 240rpx;
  862. image {
  863. width: 700rpx;
  864. height: 370rpx;
  865. }
  866. .carousel-item {
  867. width: 100%;
  868. height: 100%;
  869. padding: 0 28rpx;
  870. overflow: hidden;
  871. }
  872. image {
  873. width: 100%;
  874. height: 100%;
  875. border-radius: $border-radius-sm;
  876. }
  877. }
  878. }
  879. .swiper-dots {
  880. display: flex;
  881. position: absolute;
  882. left: 60rpx;
  883. bottom: 15rpx;
  884. width: 72rpx;
  885. height: 36rpx;
  886. background-size: 100% 100%;
  887. .num {
  888. width: 36rpx;
  889. height: 36rpx;
  890. border-radius: 50px;
  891. font-size: 24rpx;
  892. color: #fff;
  893. text-align: center;
  894. line-height: 36rpx;
  895. }
  896. .sign {
  897. position: absolute;
  898. top: 0;
  899. left: 50%;
  900. line-height: 36rpx;
  901. font-size: 12rpx;
  902. color: #fff;
  903. transform: translateX(-50%);
  904. }
  905. }
  906. /* 分类 */
  907. .cate-section {
  908. display: flex;
  909. justify-content: space-around;
  910. align-items: center;
  911. flex-wrap: wrap;
  912. padding: 30rpx 22rpx;
  913. .cate-item {
  914. display: flex;
  915. flex-direction: column;
  916. align-items: center;
  917. font-size: $font-sm + 2rpx;
  918. color: $font-color-dark;
  919. }
  920. /* 原图标颜色太深,不想改图了,所以加了透明度 */
  921. image {
  922. width: 88rpx;
  923. height: 88rpx;
  924. margin-bottom: 14rpx;
  925. border-radius: 50%;
  926. opacity: 0.7;
  927. }
  928. }
  929. // 中间广告图片
  930. .ad-1 {
  931. width: 100%;
  932. height: 210rpx;
  933. padding: 10rpx 0;
  934. background: #fff;
  935. image {
  936. width: 100%;
  937. height: 100%;
  938. }
  939. }
  940. /*公用边框样式*/
  941. %icon {
  942. margin-right: 10rpx;
  943. display: inline-block;
  944. padding: 2rpx 10rpx;
  945. border: 1rpx solid $color-yellow;
  946. color: $color-yellow;
  947. line-height: 1;
  948. font-size: $font-base;
  949. border-radius: 10rpx;
  950. }
  951. .f-header {
  952. display: flex;
  953. align-items: center;
  954. height: 92rpx;
  955. padding: 6rpx 30rpx 8rpx;
  956. image {
  957. flex-shrink: 0;
  958. width: 80rpx;
  959. height: 80rpx;
  960. margin-right: 20rpx;
  961. }
  962. .tit-box {
  963. @extend %font-title-box;
  964. }
  965. .tit {
  966. @extend %font-title;
  967. }
  968. .iconenter {
  969. font-size: $font-lg + 2rpx;
  970. color: $font-color-light;
  971. }
  972. .f-left-icon {
  973. @extend %f-left-icon;
  974. }
  975. .iconfont {
  976. font-size: $font-sm - 2rpx;
  977. }
  978. }
  979. // 会员升级礼包
  980. .uservip {
  981. border-radius: $border-radius-sm;
  982. background-color: white;
  983. box-shadow: $box-shadow;
  984. height: 300rpx;
  985. margin: 0 30rpx;
  986. image {
  987. height: 100%;
  988. width: 300rpx;
  989. }
  990. .detail {
  991. position: relative;
  992. padding: 20rpx;
  993. height: 100%;
  994. .icon {
  995. @extend %icon;
  996. }
  997. .price-box {
  998. position: absolute;
  999. bottom: 20rpx;
  1000. width: calc(100% - 40rpx);
  1001. .price {
  1002. font-size: $font-lg + 2rpx;
  1003. font-weight: bold;
  1004. color: $font-color-base;
  1005. }
  1006. .text {
  1007. color: $color-gray;
  1008. font-size: $font-sm;
  1009. }
  1010. }
  1011. .title {
  1012. font-size: $font-lg;
  1013. font-weight: bold;
  1014. }
  1015. }
  1016. }
  1017. /* 猜你喜欢 */
  1018. .guess-section {
  1019. display: flex;
  1020. flex-wrap: wrap;
  1021. padding: 0 30rpx;
  1022. .guess-item {
  1023. overflow: hidden;
  1024. display: flex;
  1025. flex-direction: column;
  1026. width: 48%;
  1027. margin-bottom: 4%;
  1028. border-radius: $border-radius-sm;
  1029. background-color: white;
  1030. box-shadow: $box-shadow;
  1031. &:nth-child(2n + 1) {
  1032. margin-right: 4%;
  1033. }
  1034. }
  1035. .image-wrapper {
  1036. width: 100%;
  1037. height: 330rpx;
  1038. border-radius: 3px;
  1039. overflow: hidden;
  1040. image {
  1041. width: 100%;
  1042. height: 100%;
  1043. opacity: 1;
  1044. }
  1045. }
  1046. .title {
  1047. font-size: $font-base;
  1048. color: $font-color-dark;
  1049. font-weight: bold;
  1050. line-height: 80rpx;
  1051. }
  1052. .price {
  1053. font-size: $font-lg;
  1054. color: $font-color-base;
  1055. font-weight: bold;
  1056. line-height: 1;
  1057. line-height: 80rpx;
  1058. }
  1059. .icon {
  1060. @extend %icon;
  1061. }
  1062. .detail {
  1063. line-height: 1;
  1064. }
  1065. .tip {
  1066. color: white;
  1067. background-color: $color-yellow;
  1068. line-height: 1.5;
  1069. font-size: $font-sm;
  1070. padding-left: 20rpx;
  1071. }
  1072. }
  1073. // 推荐
  1074. .recommend {
  1075. width: 95%;
  1076. height: 155rpx;
  1077. margin: 0rpx auto;
  1078. padding-top: 30rpx;
  1079. font-size: 26rpx;
  1080. text-align: center;
  1081. color: #333333;
  1082. align-items: flex-start;
  1083. .recommend_list {
  1084. width: 33%;
  1085. }
  1086. .re_title {
  1087. font-size: 32rpx;
  1088. font-weight: bold;
  1089. }
  1090. .re_name {
  1091. color: #999999;
  1092. padding-top: 10rpx;
  1093. }
  1094. .selected_icon {
  1095. width: 25rpx;
  1096. height: 10rpx;
  1097. margin: 0px auto;
  1098. display: none;
  1099. image {
  1100. width: 100%;
  1101. height: 100%;
  1102. }
  1103. }
  1104. .active {
  1105. display: block;
  1106. }
  1107. .active_color {
  1108. color: #dc4d46 !important;
  1109. }
  1110. }
  1111. // 列表
  1112. .list-box-h {
  1113. height: 1550rpx;
  1114. }
  1115. // 优惠券
  1116. .coupon-list {
  1117. display: inline-block;
  1118. }
  1119. .row {
  1120. border-radius: 15rpx;
  1121. margin: 25rpx;
  1122. height: 155rpx;
  1123. // width: 552rpx;
  1124. overflow: hidden;
  1125. background-color: #ffffff;
  1126. padding-right: 25rpx;
  1127. .list-interval {
  1128. border: 1px dashed $border-color-light;
  1129. height: 100%;
  1130. .top,
  1131. .bottom {
  1132. border-radius: 100rpx;
  1133. width: 30rpx;
  1134. height: 30rpx;
  1135. position: absolute;
  1136. background-color: $page-color-base;
  1137. right: -15rpx;
  1138. }
  1139. .top {
  1140. top: -18rpx;
  1141. }
  1142. .bottom {
  1143. bottom: -18rpx;
  1144. }
  1145. }
  1146. .list-money {
  1147. height: 100%;
  1148. min-width: 155rpx;
  1149. text-align: center;
  1150. image {
  1151. height: 100%;
  1152. width: 20rpx;
  1153. }
  1154. .list-money-text {
  1155. flex-grow: 1;
  1156. padding: 0 25rpx;
  1157. .tit {
  1158. text-align: center;
  1159. padding: 15rpx 0rpx;
  1160. font-size: 55rpx;
  1161. color: $color-red;
  1162. font-weight: bold;
  1163. &.noAction {
  1164. color: $font-color-light;
  1165. }
  1166. }
  1167. .price {
  1168. padding-bottom: 25rpx;
  1169. color: $font-color-light;
  1170. }
  1171. }
  1172. }
  1173. .row_list_right {
  1174. // flex-grow: 1;
  1175. min-width: 200rpx;
  1176. padding-left: 25rpx;
  1177. line-height: 1;
  1178. .right_time {
  1179. padding: 10rpx 0rpx;
  1180. color: $font-color-light;
  1181. font-size: $font-sm;
  1182. }
  1183. .right_top {
  1184. margin: 15rpx 0;
  1185. .right_name {
  1186. font-size: $font-base;
  1187. color: #bc253a;
  1188. font-weight: bold;
  1189. }
  1190. .right_title {
  1191. font-size: $font-base;
  1192. color: $font-base;
  1193. font-weight: bold;
  1194. &.noAction {
  1195. color: $font-color-light;
  1196. }
  1197. }
  1198. }
  1199. }
  1200. .right_use {
  1201. margin: 15rpx 0;
  1202. padding: 10rpx;
  1203. width: 160rpx;
  1204. text-align: center;
  1205. color: #fff;
  1206. background-color: #bc253a;
  1207. border-radius: 50rpx;
  1208. font-size: $font-sm;
  1209. &.noAction {
  1210. background-color: $font-color-light;
  1211. }
  1212. }
  1213. .iconlocation {
  1214. font-size: 36rpx;
  1215. color: $font-color-light;
  1216. }
  1217. }
  1218. </style>
  1219. =======
  1220. <template>
  1221. <view class="">
  1222. 1111
  1223. </view>
  1224. </template>
  1225. <script>
  1226. </script>
  1227. <style lang="scss">
  1228. </style>
  1229. >>>>>>> 1062124a14605e6952753b8ba2e3f401c676404f