index.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496
  1. <template>
  2. <view style="overflow-x: hidden;">
  3. <view>
  4. <view id="top"
  5. style="background-repeat: no-repeat; background-size: cover; width: 750rpx;position: fixed;top: 0;z-index: 999;"
  6. :style="{backgroundImage:headerOptions.bgImg.top?(`url(${JSON.parse(headerOptions.bgImg.top)[0].url})`):'url(https://kxmalls.oss-cn-hangzhou.aliyuncs.com/bg/top.png)'}">
  7. <view class="status-bar"></view>
  8. <view class="flex align-center justify-center text-white"
  9. style="font-size: 36rpx;font-weight: 500; position: absolute;width: 750rpx;"
  10. :style="'top:'+navbarTop+'px;height:'+navHeight+'px;'">
  11. {{siteName}}
  12. </view>
  13. <view v-if="appear" :style="'margin-top:'+MT+'px;'" class="flex justify-between align-center padding-lr ">
  14. <view @click="showLocationList" class="flex align-center" style="padding-left: 6rpx;">
  15. <image src="../../static/index/dingweiweizhi@3x.png" mode="aspectFit" style="width: 30rpx;height: 36rpx;">
  16. </image>
  17. <view style="font-size: 36rpx;font-weight: 500;max-width: 450rpx;"
  18. class="padding-lr-xs text-white text-cut">{{district}}</view>
  19. <image src="../../static/index/arrow_down.png" mode="aspectFit" style="width: 18rpx;height: 10rpx;"></image>
  20. </view>
  21. <image src="../../static/index/saoma@3x.png" mode="aspectFit"
  22. style="width: 36rpx;height: 36rpx;margin-right: 6rpx;" @click="onScanQrCode"></image>
  23. </view>
  24. <view v-if="appear" class="padding-lr" style="padding-bottom: 22rpx;padding-top: 24rpx;">
  25. <view @click="naviageToPage('/pages/product/search')" style="height: 64rpx;"
  26. class="bg-white round flex align-center" v-if="headerOptions.search.show">
  27. <view class="flex align-center padding-left">
  28. <text class="yticon icon-sousuo" style="margin-right: 10rpx;"></text><text class="lem-text-gray"
  29. style="font-size: 26rpx;">{{headerOptions.search.placeholder}}</text>
  30. </view>
  31. </view>
  32. </view>
  33. <view v-else class="padding-lr flex align-center" :style="'margin-top:'+MT2+'px;'"
  34. style="padding-bottom: 22rpx;padding-top: 24rpx;">
  35. <view @click="showLocationList" class="flex align-center padding-right-sm">
  36. <image src="../../static/index/dingweiweizhi@3x.png" mode="aspectFit" style="width: 25rpx;height: 30rpx;">
  37. </image>
  38. <view style="font-size: 30rpx;font-weight: 500;max-width: 150rpx;"
  39. class="padding-lr-xs text-cut text-white">{{district}}</view>
  40. <image src="../../static/index/arrow_down.png" mode="aspectFit" style="width: 18rpx;height: 10rpx;"></image>
  41. </view>
  42. <view @click="naviageToPage('/pages/product/search')" style="height: 64rpx;flex-grow: 1;flex-shrink: 0;"
  43. class="bg-white round flex align-center" v-if="headerOptions.search.show">
  44. <view class="flex align-center padding-left">
  45. <text class="yticon icon-sousuo" style="margin-right: 10rpx;"></text><text class="lem-text-gray"
  46. style="font-size: 26rpx;">{{headerOptions.search.placeholder}}</text>
  47. </view>
  48. </view>
  49. <image src="../../static/index/saoma@3x.png" mode="aspectFit"
  50. style="width: 36rpx;height: 36rpx;margin-left: 10rpx;" @click="onScanQrCode"></image>
  51. </view>
  52. </view>
  53. </view>
  54. <view :style="'height: '+topHeight+'px;'" style="width: 100%;display: flex; position: relative;"></view>
  55. <view v-if="storage" id="sw" style="z-index: 999;background-repeat: no-repeat; background-size: 750rpx 200rpx;"
  56. class="padding-top-sm"
  57. :style="{backgroundImage:headerOptions.bgImg.bottom?(`url(${JSON.parse(headerOptions.bgImg.bottom)[0].url})`):'url(https://kxmalls.oss-cn-hangzhou.aliyuncs.com/bg/bottom.png)'}">
  58. <swiper autoplay="true" interval="2000" duration="400" class="carousel" circular @change="swiperChange"
  59. :previous-margin="headerOptions.swiper.showStyle!=='0px'?'27rpx':0"
  60. :next-margin="headerOptions.swiper.showStyle!=='0px'?'27rpx':0" v-if="headerOptions.swiper.show">
  61. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
  62. :style="{padding:headerOptions.swiper.showStyle!=='0px'?'0 11upx':0}" @click="naviageToPage(item.url)">
  63. <image :src="JSON.parse(item.imgUrl)[0].url"
  64. :mode="headerOptions.swiper.imgStyle==='cover'?'aspectFill':'scaleToFill'" />
  65. </swiper-item>
  66. </swiper>
  67. </view>
  68. <view v-if="storage" id="bar" class="padding bg-white margin-bottom-sm"
  69. style="display: flex;align-items: center;justify-content: space-between;">
  70. <view class="flex align-center" v-for="(item,i) in headerOptions.hints" :key="i">
  71. <image :src="item.icon?JSON.parse(item.icon)[0].url:('../../static/index/'+(i+''+i)+'.png')" mode="aspectFit"
  72. style="width: 36rpx;height: 30rpx;"></image>
  73. <text class="margin-left-sm lem-text-gray" style="font-size: 24rpx;">{{item.text}}</text>
  74. </view>
  75. <!-- <view class="flex align-center">
  76. <image src="../../static/index/wuliu2.png" mode="aspectFit" style="width: 36rpx;height: 30rpx;"></image>
  77. <text class="margin-left-sm lem-text-gray" style="font-size: 24rpx;;">晚到必赔</text>
  78. </view>
  79. <view class="flex align-center">
  80. <image src="../../static/index/star2.png" mode="aspectFit" style="width: 36rpx;height: 30rpx;"></image>
  81. <text class="margin-left-sm lem-text-gray" style="font-size: 24rpx;;">专业检测</text>
  82. </view>
  83. <view class="flex align-center">
  84. <image src="../../static/index/time1.png" mode="aspectFit" style="width: 36rpx;height: 30rpx;"></image>
  85. <text class="margin-left-sm lem-text-gray" style="font-size: 24rpx;">30分钟达</text>
  86. </view> -->
  87. </view>
  88. <!-- Floating coupon box -->
  89. <view class="coupon-box" :class="{'hidden': isHidden, 'transparent': isTransparent}" @click="navigateToCoupons">
  90. <text>领券</text>
  91. </view>
  92. <!-- <announcement :storage="storage" :new-times-content="newTimesContent"></announcement>
  93. <navigation :storage="storage" :category-buttom-list="categoryButtomList" @naviage-to-page="naviageToPage">
  94. </navigation>
  95. <special :storage="storage" :cheap-recommend="cheapRecommend" @naviage-to-page="naviageToPage"
  96. @nav-to-detail-page="navToDetailPage" @add-cart="addCart"></special>
  97. <recommend :storage="storage" :sales-top="salesTop" @naviage-to-page="naviageToPage"
  98. @nav-to-detail-page="navToDetailPage" @add-cart="addCart"></recommend>
  99. <seckill></seckill> -->
  100. <template v-for="m in moduleList">
  101. <!-- <component :is="m.id" >
  102. </component> -->
  103. <announcement v-if="m.id==='announcement'" :storage="storage" :new-times-content="newTimesContent"
  104. :category-buttom-list="categoryButtomList" :cheap-recommend="cheapRecommend" @naviage-to-page="naviageToPage"
  105. :sales-top="salesTop" @nav-to-detail-page="navToDetailPage" @add-cart="addCart" :options="m.options"
  106. :key="m.id">
  107. </announcement>
  108. <navigation v-if="m.id==='navigation'" :storage="storage" :new-times-content="newTimesContent"
  109. :category-buttom-list="categoryButtomList" :cheap-recommend="cheapRecommend" @naviage-to-page="naviageToPage"
  110. :sales-top="salesTop" @nav-to-detail-page="navToDetailPage" @add-cart="addCart" :options="m.options"
  111. :key="m.id">
  112. </navigation>
  113. <recommend v-if="m.id==='recommend'" :storage="storage" :new-times-content="newTimesContent"
  114. :category-buttom-list="categoryButtomList" :cheap-recommend="cheapRecommend" @naviage-to-page="naviageToPage"
  115. :sales-top="salesTop" @nav-to-detail-page="navToDetailPage" @add-cart="addCart" :options="m.options"
  116. :key="m.id">
  117. </recommend>
  118. <seckill v-if="m.id==='seckill'" :storage="storage" :new-times-content="newTimesContent"
  119. :category-buttom-list="categoryButtomList" :cheap-recommend="cheapRecommend" @naviage-to-page="naviageToPage"
  120. :sales-top="salesTop" @nav-to-detail-page="navToDetailPage" @add-cart="addCart" :options="m.options"
  121. :key="m.id"></seckill>
  122. <special v-if="m.id==='special'" :storage="storage" :new-times-content="newTimesContent"
  123. :category-buttom-list="categoryButtomList" :cheap-recommend="cheapRecommend" @naviage-to-page="naviageToPage"
  124. :sales-top="salesTop" @nav-to-detail-page="navToDetailPage" @add-cart="addCart" :options="m.options"
  125. :key="m.id"></special>
  126. </template>
  127. <view v-if="!storage" style="padding-top: 180rpx;padding-bottom: 180rpx;">
  128. <missing :buttonName="'换个地址试试吧~'" :handlerName="'buttonClick'" @buttonClick="chooseLocation"
  129. :imgUrl="'http://qiniuoss.nauzone.cn/%E7%BB%84%204%20%E6%8B%B7%E8%B4%9D@3x.png'" :desc="'当前地区不在配送范围哦'">
  130. </missing>
  131. </view>
  132. <view class="Bigmask" :class="ismask?'opAC':'op'" @click="nomask"></view>
  133. <view class="maskBox" :class="ismask?'scAC':'sc'">
  134. <image src="../../static/Invitation/close.png" mode="" class="maskClose" @click.stop="nomask"></image>
  135. <image :src="t5.imgUrl" mode="" class="mask" @click="naviageToPage('/pages/Invitation/Invitation')"></image>
  136. <!-- Invitation inviteNewpeople-->
  137. </view>
  138. </view>
  139. </template>
  140. <script>
  141. import missing from "@/components/missing.vue"
  142. import Announcement from './components/announcement'
  143. import Navigation from './components/navigation'
  144. import Special from './components/special'
  145. import Recommend from './components/recommend'
  146. import Seckill from './components/seckill'
  147. import {
  148. parseURL
  149. } from "../../util"
  150. export default {
  151. components: {
  152. missing,
  153. Announcement,
  154. Navigation,
  155. Special,
  156. Recommend,
  157. Seckill
  158. },
  159. data() {
  160. return {
  161. isHidden: false, // 是否隐藏边框的一半
  162. isTransparent: false, // 是否增加透明度
  163. lastScrollY: 0, // 上一次的滚动位置
  164. isScrolling: false, // 当前是否正在滚动
  165. timer: null, // 延迟恢复的定时器
  166. titleNViewBackground: '',
  167. swiperCurrent: 0,
  168. swiperLength: 0,
  169. carouselList: [],
  170. windowSpuList: [],
  171. cheapRecommend: [], //特价接口
  172. categoryPickList: [],
  173. categoryButtomList: [],
  174. salesTop: [],
  175. newTop: [],
  176. banner: undefined,
  177. isVip: false,
  178. district: '定位中...',
  179. navbarTop: 26,
  180. navHeight: 32,
  181. navBottom: 58,
  182. MT: 38,
  183. MT2: 20,
  184. statusHeight: 20,
  185. pageNo: 1,
  186. storage: true,
  187. topHeight: 156,
  188. appear: true,
  189. loaded: false, //是否已加载过
  190. total: 10, //推荐商品总数
  191. t5: {},
  192. ismask: false,
  193. newTimesContent: '',
  194. indexBanner: {
  195. imgUrl: ''
  196. },
  197. template: null,
  198. siteName: 'kxmall'
  199. };
  200. },
  201. computed: {
  202. headerOptions() {
  203. return this.template?.headerModule.options || {
  204. search: {
  205. show: true,
  206. placeholder: ''
  207. },
  208. bgImg: {
  209. top: '',
  210. bottom: ''
  211. },
  212. swiper: {
  213. show: true,
  214. showStyle: '12rpx 20rpx 0rpx',
  215. imgStyle: '100% 100%'
  216. },
  217. hints: []
  218. }
  219. },
  220. moduleList() {
  221. return this.template?.moduleList
  222. }
  223. },
  224. async onShow() {
  225. let addresses = uni.getStorageSync('addresses');
  226. if (addresses) {
  227. this.district = addresses.addressesName;
  228. } else {
  229. this.district = '定位中...';
  230. }
  231. this.isVip = this.$api.isVip()
  232. if (this.loaded) {
  233. this.$store.state.storageId ? this.storage = true : this.storage = false
  234. if (this.$store.state.storageId && this.categoryButtomList.length == 0) {
  235. this.loadData(this.$store.state.storageId)
  236. }
  237. }
  238. //如果用户已登录,获取购物车数量
  239. if (this.$store.state.userInfo.accessToken && this.$store.state.storageId != 0) {
  240. this.$api.request('get', 'cart/app/countCart', {
  241. storageId: this.$store.state.storageId
  242. }).then(res => {
  243. if (res.data > 0) {
  244. uni.setTabBarBadge({
  245. index: 2,
  246. text: res.data + ''
  247. })
  248. } else if (res.data <= 0) {
  249. uni.removeTabBarBadge({
  250. index: 2
  251. })
  252. }
  253. this.$store.commit('addCart', res.data)
  254. }).catch(err => {
  255. this.$api.msg('请求失败,请稍后再试')
  256. })
  257. }
  258. await this.getTemplate()
  259. this.$nextTick(() => {
  260. this.setTopHeight()
  261. })
  262. },
  263. async onLoad(options) {
  264. this.$api.request('get', 'system/app/config/configKey/basicinfo').then(({
  265. data
  266. }) => {
  267. const baseInfo = {}
  268. data.forEach(({
  269. configKey,
  270. configValue
  271. }) => {
  272. baseInfo[configKey] = configValue
  273. })
  274. if (baseInfo.siteName) {
  275. this.siteName = baseInfo.siteName
  276. }
  277. })
  278. //#ifdef MP-WEIXIN
  279. wx.showShareMenu({
  280. withShareTicket: true,
  281. menus: ['shareAppMessage', 'shareTimeline']
  282. });
  283. //#endif
  284. //#ifdef H5
  285. //H5进入,有可能是回调进来的
  286. if (options.code && options.state) {
  287. const that = this
  288. that.logining = true
  289. that.$api.request('get', 'h5Login', {
  290. loginType: 3,
  291. raw: options.code
  292. }, failres => {
  293. that.logining = false
  294. that.$api.msg(failres.msg)
  295. }).then(res => {
  296. //登录成功,重定向到指定目标
  297. that.logining = false
  298. that.$store.commit('login', res.data)
  299. uni.setStorageSync('userInfo', res.data)
  300. //重定向到
  301. //不能重定向到tabbar页面
  302. if (options.state === '/pages/cart/cart' || options.state === '/pages/user/user' ||
  303. options.state === '/pages/index/index' || options.state === '/pages/category/category') {
  304. uni.switchTab({
  305. url: options.state
  306. })
  307. } else {
  308. uni.redirectTo({
  309. url: options.state
  310. })
  311. }
  312. })
  313. }
  314. //#endif
  315. this.$api.request('get', 'carousel/app/getCarouselActive', {
  316. adType: 6
  317. }).then(res => {
  318. this.indexBanner = res.data[0]
  319. })
  320. let addresses = uni.getStorageSync('addresses');
  321. let res1 = {};
  322. if (addresses) {
  323. this.district = addresses.addressesName;
  324. res1.longitude = addresses.lng
  325. res1.latitude = addresses.lat
  326. res1.errMsg = 'getLocation:ok'
  327. } else {
  328. //#ifdef H5
  329. res1.errMsg = 'getLocation:ok'
  330. res1.longitude = '11.22'
  331. res1.latitude = '11.22'
  332. //#endif
  333. // #ifdef MP-WEIXIN
  334. var [err, result] = await uni.getLocation({
  335. type: 'wgs84'
  336. })
  337. res1 = result
  338. //#endif
  339. }
  340. // ================
  341. // var res1={}
  342. // res1.errMsg ='getLocation:ok'
  343. // res1.longitude ='11.22'
  344. // res1.latitude ='11.22'
  345. // ================
  346. if (res1.errMsg === 'getLocation:ok') {
  347. uni.showLoading({
  348. title: "加载中..."
  349. })
  350. this.$api.request('get', 'storage/position/getRecentlyStorage', {
  351. lng: res1.longitude,
  352. lat: res1.latitude
  353. }, failres => {
  354. uni.hideLoading()
  355. this.logining = false
  356. this.loaded = true
  357. this.$api.msg(failres.msg)
  358. this.storage = false
  359. }).then(res => {
  360. uni.hideLoading()
  361. this.loaded = true
  362. // 设置距离值
  363. let addresses = uni.getStorageSync('addresses');
  364. if (!addresses) {
  365. let addressesInfo = {};
  366. addressesInfo.lng = res1.longitude;
  367. addressesInfo.lat = res1.latitude;
  368. addressesInfo.distance = res.data.distance;
  369. uni.setStorageSync('addresses', addressesInfo);
  370. } else {
  371. addresses.distance = res.data.distance;
  372. uni.setStorageSync('addresses', addresses);
  373. }
  374. this.$store.state.storageId === -1 && this.$store.commit('setStorage', res.data.id)
  375. this.$store.commit('setStorageObj', {
  376. businessStartTime: res.data.businessStartTime,
  377. businessState: res.data.businessState,
  378. businessStopTime: res.data.businessStopTime,
  379. deliveryStartTime: res.data.deliveryStartTime,
  380. deliveryStopTime: res.data.deliveryStopTime,
  381. haveStorage: res.data.haveStorage,
  382. id: res.data.id
  383. })
  384. this.loadData(res.data.id)
  385. if (!res.data.id) {
  386. this.storage = false
  387. }
  388. })
  389. }
  390. if (!addresses || !addresses.addressesName) {
  391. var address = await this.$getLocation(false, res1.latitude, res1.longitude)
  392. if (address.streetNumber.street.length > 0) {
  393. this.district = address.streetNumber.street
  394. } else {
  395. this.district = address.township
  396. }
  397. if (address.pois.length > 0 && address.pois[0].name.length < 8) {
  398. this.district = address.pois[0].name
  399. let addresses = uni.getStorageSync('addresses');
  400. if (addresses) {
  401. addresses.addressesName = address.pois[0].name;
  402. uni.setStorageSync('addresses', addresses);
  403. }
  404. }
  405. }
  406. // this.district = address ? address.district : '定位失败'
  407. //获取前置仓数据
  408. // console.log(address)
  409. // this.$api.request('position','getRecentlyStorage',{
  410. // adcode:address.adcode,lng:address.longitude,
  411. // lat:address.latitude
  412. // },failres => {
  413. // this.logining = false
  414. // this.$api.msg(failres.errmsg)
  415. // }).then(res=>{
  416. // console.log(res)
  417. // // res.data.id = 11
  418. // // this.$store.commit('setStorage',res.data.id)
  419. // // this.loadData(res.data.id)
  420. // // if(!res.data.id){
  421. // // this.storage = false
  422. // // }else{
  423. // // this.loadRecommand('refresh')
  424. // // }
  425. // })
  426. // console.log(JSON.stringify(address))
  427. },
  428. onPageScroll(e) {
  429. e.scrollTop >= 100 ? this.appear = false : this.appear = true
  430. },
  431. onReachBottom() {
  432. if (this.salesTop.length % 10 == 0 && this.salesTop.length > 0) {
  433. this.loadRecommand()
  434. }
  435. },
  436. onReady() {
  437. this.setTopHeight()
  438. // const res = uni.getSystemInfoSync();
  439. // console.log(res.statusBarHeight);
  440. // this.statusHeight = res.statusBarHeight
  441. // // #ifdef MP-WEIXIN
  442. // this.navbarTop = wx.getMenuButtonBoundingClientRect().top
  443. // this.navHeight = wx.getMenuButtonBoundingClientRect().height
  444. // this.navBottom = wx.getMenuButtonBoundingClientRect().bottom
  445. // this.MT = this.navBottom
  446. // // #endif
  447. // // #ifdef APP-PLUS
  448. // this.navbarTop = this.statusHeight
  449. // this.navHeight = 44
  450. // this.navBottom = this.navHeight + 20
  451. // this.MT = this.navBottom
  452. // // #endif
  453. // // #ifdef H5
  454. // this.navbarTop = 5;
  455. // // #endif
  456. // this.MT2 = this.MT - 20
  457. // const that = this
  458. // const query = uni.createSelectorQuery().in(this);
  459. // this.$nextTick(() => {
  460. // query.select('#top').boundingClientRect(data => {
  461. // console.log("得到布局位置信息" + JSON.stringify(data));
  462. // console.log("节点离页面顶部的距离为" + data.top);
  463. // that.topHeight = data.height + that.statusHeight - 5
  464. // // #ifdef APP-PLUS
  465. // that.topHeight = data.height + 20
  466. // console.log('占位元素高度为' + that.topHeight)
  467. // // #endif
  468. // }).exec();
  469. // })
  470. },
  471. onShareAppMessage(res) { //发送给朋友
  472. return {
  473. title: this.share.title,
  474. imageUrl: this.share.imageUrl,
  475. }
  476. },
  477. onShareTimeline(res) { //分享到朋友圈
  478. return {
  479. title: this.share.title,
  480. imageUrl: this.share.imageUrl,
  481. }
  482. },
  483. mounted() {
  484. // Add scroll listener when component is mounted
  485. uni.pageScrollTo({
  486. scrollTop: 0, // Ensures the page starts at the top
  487. duration: 0,
  488. });
  489. // Listen to the scroll event
  490. // uni.onPageScroll(this.onPageScroll);
  491. },
  492. beforeDestroy() {
  493. // Remove scroll listener before destroying the component
  494. uni.offPageScroll(this.onPageScroll);
  495. },
  496. methods: {
  497. // 处理滚动事件,改变红包的状态
  498. onPageScroll(e) {
  499. const scrollY = e.scrollTop;
  500. // 如果正在滚动,设置隐藏和透明度
  501. if (scrollY > this.lastScrollY) {
  502. this.isHidden = true;
  503. this.isTransparent = true;
  504. } else {
  505. this.isHidden = false;
  506. this.isTransparent = false;
  507. }
  508. // 保存最后的滚动位置
  509. this.lastScrollY = scrollY;
  510. // 如果正在滚动,取消任何定时器
  511. if (this.timer) {
  512. clearTimeout(this.timer);
  513. this.timer = null;
  514. }
  515. // 如果停止滚动(延迟500ms),恢复样式
  516. if (!this.isScrolling) {
  517. this.timer = setTimeout(() => {
  518. this.isHidden = false;
  519. this.isTransparent = false;
  520. }, 500); // 延迟恢复
  521. }
  522. },
  523. // Handle click on the coupon box to navigate to the coupon page
  524. navigateToCoupons() {
  525. uni.navigateTo({
  526. url: '/pages/user/coupons?type=user'
  527. });
  528. },
  529. showLocationList() {
  530. uni.navigateTo({
  531. url: '/pages/index/locationList'
  532. })
  533. },
  534. setTopHeight() {
  535. const res = uni.getSystemInfoSync();
  536. this.statusHeight = res.statusBarHeight
  537. // #ifdef MP-WEIXIN
  538. this.navbarTop = wx.getMenuButtonBoundingClientRect().top
  539. this.navHeight = wx.getMenuButtonBoundingClientRect().height
  540. this.navBottom = wx.getMenuButtonBoundingClientRect().bottom
  541. this.MT = this.navBottom
  542. // #endif
  543. // #ifdef APP-PLUS
  544. this.navbarTop = this.statusHeight
  545. this.navHeight = 44
  546. this.navBottom = this.navHeight + 20
  547. this.MT = this.navBottom
  548. // #endif
  549. // #ifdef H5
  550. this.navbarTop = 5;
  551. // #endif
  552. this.MT2 = this.MT - 20
  553. const that = this
  554. const query = uni.createSelectorQuery().in(this);
  555. this.$nextTick(() => {
  556. query.select('#top').boundingClientRect(data => {
  557. // that.topHeight = data.height + that.statusHeight - 5
  558. if (this.appear) {
  559. that.topHeight = data.height - 5
  560. } else {
  561. that.topHeight = data.height + 40
  562. }
  563. // #ifdef APP-PLUS
  564. if (this.appear) {
  565. that.topHeight = data.height
  566. } else {
  567. that.topHeight = data.height + 40
  568. }
  569. // #endif
  570. }).exec();
  571. })
  572. },
  573. async getTemplate() {
  574. this.template = {
  575. "moduleList": [{
  576. "id": "announcement",
  577. "_uid": "announcement_velftufbt1o0",
  578. "limit": 1,
  579. "style": {
  580. "backgroundPosition": "-90px -345px",
  581. "hoverBackgroundPosition": "-130px -345px"
  582. },
  583. "title": "通知公告",
  584. "options": {},
  585. "selectable": true
  586. },
  587. {
  588. "id": "navigation",
  589. "_uid": "navigation_124p8hba2l180",
  590. "limit": 1,
  591. "style": {
  592. "backgroundPosition": "-10px -345px",
  593. "hoverBackgroundPosition": "-50px -345px"
  594. },
  595. "title": "图文导航",
  596. "options": {
  597. "banner": {
  598. "imgStyle": "100% 100%",
  599. "showStyle": "12px 12px 0px"
  600. },
  601. "bgColor": null,
  602. "fontColor": null,
  603. "iconStyle": "50%",
  604. "showStyle": "0px"
  605. },
  606. "selectable": true
  607. },
  608. {
  609. "id": "special",
  610. "_uid": "special_lmqte3o8qqk0",
  611. "limit": 1,
  612. "style": {
  613. "backgroundPosition": "-250px -345px",
  614. "hoverBackgroundPosition": "-290px -345px"
  615. },
  616. "title": "今日特价",
  617. "options": {
  618. "banner": {
  619. "show": true,
  620. "imgUrl": "",
  621. "imgStyle": "100% 100%",
  622. "showStyle": "12px 12px 0px"
  623. },
  624. "scroll": true
  625. },
  626. "selectable": true
  627. },
  628. {
  629. "id": "recommend",
  630. "_uid": "recommend_p8gjlc2llj40",
  631. "limit": 1,
  632. "style": {
  633. "backgroundPosition": "-10px -384px",
  634. "hoverBackgroundPosition": "-50px -384px"
  635. },
  636. "title": "热卖推荐",
  637. "options": {
  638. "banner": {
  639. "show": true,
  640. "imgUrl": "",
  641. "imgStyle": "100% 100%",
  642. "showStyle": "12px 12px 0px"
  643. },
  644. "scroll": false
  645. },
  646. "selectable": true
  647. }
  648. ],
  649. "pageOptions": {
  650. "name": "2",
  651. "isUseDefaultPic": true
  652. },
  653. "footerModule": {
  654. "id": "footer",
  655. "title": "底部导航",
  656. "options": {
  657. "bgColor": "",
  658. "navItems": [{
  659. "_uid": "tl0kk9ota580",
  660. "icon": {
  661. "active": "",
  662. "default": ""
  663. },
  664. "text": "首页",
  665. "sortable": false,
  666. "removable": false
  667. },
  668. {
  669. "_uid": "thelhu84gt80",
  670. "icon": {
  671. "active": "",
  672. "default": ""
  673. },
  674. "text": "我的",
  675. "sortable": true,
  676. "removable": false
  677. }
  678. ],
  679. "fontColor": {
  680. "active": "",
  681. "default": ""
  682. }
  683. },
  684. "selectable": false
  685. },
  686. "headerModule": {
  687. "id": "header",
  688. "title": "页面头部",
  689. "options": {
  690. "bgImg": {
  691. "top": "",
  692. "bottom": ""
  693. },
  694. "hints": [{
  695. "icon": "",
  696. "text": "免费配送"
  697. },
  698. {
  699. "icon": "",
  700. "text": "晚到必赔"
  701. },
  702. {
  703. "icon": "",
  704. "text": "专业检测"
  705. },
  706. {
  707. "icon": "",
  708. "text": "30分钟达"
  709. }
  710. ],
  711. "search": {
  712. "show": true,
  713. "placeholder": ""
  714. },
  715. "swiper": {
  716. "show": true,
  717. "imgStyle": "100% 100%",
  718. "showStyle": "12px 20px 0px"
  719. }
  720. },
  721. "selectable": false
  722. }
  723. }
  724. try {
  725. const res = await this.$api.request('get', 'decorate/app/pageTemplate')
  726. if (res.data) {
  727. this.template = JSON.parse(res.data.content)
  728. }
  729. } catch (e) {
  730. console.log(e)
  731. }
  732. },
  733. async loadData(id) {
  734. const that = this
  735. if (!id) {
  736. id = 0
  737. }
  738. uni.showLoading({
  739. title: "加载中..."
  740. })
  741. that.$api.request('get', 'storage/position/getIndexDataByStorage', {
  742. storageId: this.$store.state.storageId
  743. }, failres => {
  744. that.$api.msg(failres.msg)
  745. uni.hideLoading()
  746. }).then(res => {
  747. let data = res.data
  748. //橱窗
  749. that.windowSpuList = data.cheapRecommend
  750. //轮播
  751. if (data.carouseList.t1) {
  752. data.carouseList.t1.forEach(item => {
  753. if (!item.color) {
  754. item.color = 'rgb(205, 215, 218)'
  755. }
  756. })
  757. that.carouselList = data.carouseList.t1
  758. that.swiperLength = data.carouseList.t1.length
  759. that.titleNViewBackground = data.carouseList.t1[0].color
  760. }
  761. if (data.cheapRecommend) {
  762. that.cheapRecommend = data.cheapRecommend
  763. }
  764. //弹窗
  765. // if (data.carouseList.t5.length > 0) {
  766. // that.t5 = data.carouseList.t5[0]
  767. // this.ismask = true
  768. // }
  769. this.newTimesContent = data.newTimesContent
  770. //分类精选
  771. if (data.carouseList.t2) {
  772. that.categoryPickList = data.carouseList.t2
  773. }
  774. //横幅
  775. if (data.carouseList.t3 && data.carouseList.t3.length > 0) {
  776. that.banner = data.carouseList.t3[0]
  777. }
  778. //热销
  779. if (data.salesTop) {
  780. that.salesTop = data.salesTop
  781. this.pageNo++
  782. }
  783. //分类5Buttom
  784. if (data.carouseList.t4) {
  785. that.categoryButtomList = data.carouseList.t4
  786. uni.setStorageSync('categoryButtomList', that.categoryButtomList);
  787. }
  788. uni.hideLoading()
  789. })
  790. },
  791. nomask() {
  792. this.ismask = false
  793. },
  794. loadRecommand(type) {
  795. console.log(type)
  796. if (type === 'refresh') {
  797. this.pageNo = 1
  798. }
  799. const that = this
  800. that.$api.request('get', 'storage/position/getGoodsPageByStorage', {
  801. storageId: this.$store.state.storageId,
  802. pageNo: this.pageNo
  803. }, failres => {
  804. that.$api.msg(failres.msg)
  805. }).then(res => {
  806. this.pageNo++
  807. let tempList = res.data.rows
  808. if (type === 'refresh') {
  809. that.salesTop = [];
  810. }
  811. that.salesTop = that.salesTop.concat(tempList)
  812. })
  813. },
  814. //轮播图切换修改背景色
  815. swiperChange(e) {
  816. const index = e.detail.current;
  817. this.swiperCurrent = index;
  818. this.titleNViewBackground = this.carouselList[index].color;
  819. },
  820. //详情页
  821. navToDetailPage(id) {
  822. uni.navigateTo({
  823. url: `/pages/product/detail?id=${id}`
  824. })
  825. },
  826. navToWindowSuggestSpu(index) {
  827. const that = this
  828. uni.navigateTo({
  829. url: '/pages/product/detail?id=' + that.windowSpuList[index].productId
  830. })
  831. },
  832. naviageToPage(page, title) {
  833. this.ismask = false
  834. if (title) {
  835. console.log(title, 'jinlai')
  836. title ? title : ''
  837. uni.navigateTo({
  838. url: page + '&title=' + title
  839. })
  840. } else {
  841. uni.navigateTo({
  842. url: page
  843. })
  844. }
  845. // console.log(that.categoryButtomList[index].title)
  846. },
  847. //选择地址
  848. chooseLocation() {
  849. uni.chooseLocation({
  850. success: (res1) => {
  851. console.log(res1)
  852. if (res1.name === "") {
  853. return
  854. }
  855. this.district = res1.name
  856. uni.showLoading({
  857. title: "加载中..."
  858. })
  859. let addressesInfo = {};
  860. addressesInfo.lng = res1.longitude;
  861. addressesInfo.lat = res1.latitude;
  862. addressesInfo.addressesName = res1.name;
  863. this.$api.request('get', 'storage/position/getRecentlyStorage', {
  864. lng: res1.longitude,
  865. lat: res1.latitude
  866. }, failres => {
  867. uni.setStorageSync('addresses', addressesInfo);
  868. uni.hideLoading()
  869. }).then(res => {
  870. uni.hideLoading()
  871. addressesInfo.distance = res.data.distance;
  872. uni.setStorageSync('addresses', addressesInfo);
  873. console.log(res)
  874. this.$store.commit('setStorage', res.data.id)
  875. this.newTop = []
  876. this.cheapRecommend = []
  877. this.salesTop = []
  878. this.loadData(res.data.id)
  879. if (!res.data.id) {
  880. this.storage = false
  881. } else {
  882. this.storage = true
  883. // this.loadRecommand('refresh')
  884. }
  885. })
  886. }
  887. });
  888. },
  889. addCart(item) {
  890. const that = this
  891. that.$api.request('get', 'cart/app/addCartItem', {
  892. productId: item.productId,
  893. activityId: item.activityId,
  894. couponId: item.couponId,
  895. num: 1
  896. }).then(res => {
  897. that.$api.msg('添加购物车成功')
  898. var cartNum = this.$store.state.cartNum + 1
  899. that.$store.commit('addCart', cartNum)
  900. uni.setTabBarBadge({
  901. index: 2,
  902. text: cartNum + ''
  903. })
  904. })
  905. },
  906. onScanQrCode() {
  907. const self = this
  908. uni.scanCode({
  909. scanType: ['qrCode'],
  910. success(res) {
  911. console.log(res)
  912. const urlParams = parseURL(res.result).params
  913. console.log(urlParams)
  914. if (urlParams.storageId) {
  915. // Handle storageId case
  916. self.$store.commit('setStorage', urlParams.storageId)
  917. uni.redirectTo({
  918. url: '/pages/index/redirect'
  919. })
  920. } else if (urlParams.spread) {
  921. // Handle spread case
  922. self.$store.commit('setSpread', urlParams.spread)
  923. uni.redirectTo({
  924. url: '/pages/public/login' // Assuming this is your login page route
  925. })
  926. } else {
  927. console.log('No valid parameters found in QR code')
  928. // You might want to show an error message to the user here
  929. }
  930. },
  931. fail(e) {
  932. console.log(e)
  933. }
  934. })
  935. }
  936. },
  937. // #ifndef MP
  938. // 标题栏input搜索框点击
  939. onNavigationBarSearchInputClicked: async function(e) {
  940. uni.navigateTo({
  941. url: '/pages/product/search'
  942. })
  943. },
  944. //点击导航栏 buttons 时触发
  945. // onNavigationBarButtonTap(e) {
  946. // const index = e.index;
  947. // if (index === 0) {
  948. // this.$api.msg('点击了扫描');
  949. // } else if (index === 1) {
  950. // // #ifdef APP-PLUS
  951. // const pages = getCurrentPages();
  952. // const page = pages[pages.length - 1];
  953. // const currentWebview = page.$getAppWebview();
  954. // currentWebview.hideTitleNViewButtonRedDot({
  955. // index
  956. // });
  957. // // #endif
  958. // uni.navigateTo({
  959. // url: '/pages/notice/notice'
  960. // })
  961. // }
  962. // }
  963. // #endif
  964. }
  965. </script>
  966. <style lang="scss">
  967. page {
  968. background: #f5f5f5;
  969. }
  970. .m-t {
  971. margin-top: 16upx;
  972. }
  973. .Bigmask {
  974. width: 100%;
  975. height: 100vh;
  976. background-color: rgba(0, 0, 0, .3);
  977. position: fixed;
  978. top: 0;
  979. left: 0;
  980. z-index: 1000;
  981. transition: all .5s,
  982. }
  983. .maskBox {
  984. width: 77%;
  985. height: 52%;
  986. position: fixed;
  987. top: 50%;
  988. left: 50%;
  989. z-index: 1001;
  990. transform: translateX(-50%) translateY(-50%) scale(1, 1);
  991. transition: all .5s ease;
  992. .maskClose {
  993. position: absolute;
  994. right: 15px;
  995. top: 15px;
  996. width: 26px;
  997. height: 26px;
  998. }
  999. .mask {
  1000. width: 100%;
  1001. height: 100%;
  1002. }
  1003. }
  1004. .op {
  1005. opacity: 0;
  1006. visibility: hidden;
  1007. }
  1008. .opAc {
  1009. visibility: visible;
  1010. opacity: 1;
  1011. }
  1012. .sc {
  1013. opacity: 0;
  1014. transform: translateX(-50%) translateY(-50%) scale(0, 0);
  1015. transition: all .5s ease;
  1016. }
  1017. .scAc {
  1018. opacity: 1;
  1019. transform: translateX(-50%) translateY(-50%) scale(1, 1);
  1020. transition: all .5s ease;
  1021. }
  1022. /* 头部 轮播图 */
  1023. .carousel-section {
  1024. position: relative;
  1025. padding-top: 10px;
  1026. .titleNview-placing {
  1027. height: var(--status-bar-height);
  1028. padding-top: 44px;
  1029. box-sizing: content-box;
  1030. }
  1031. .titleNview-background {
  1032. position: absolute;
  1033. top: 0;
  1034. left: 0;
  1035. width: 100%;
  1036. height: 426upx;
  1037. transition: .4s;
  1038. }
  1039. }
  1040. .carousel {
  1041. width: 100%;
  1042. height: 280upx;
  1043. .carousel-item {
  1044. width: 100%;
  1045. height: 100%;
  1046. // padding: 0 11upx;
  1047. overflow: hidden;
  1048. }
  1049. image {
  1050. width: 100%;
  1051. height: 100%;
  1052. border-radius: 12upx;
  1053. }
  1054. }
  1055. .swiper-dots {
  1056. display: flex;
  1057. position: absolute;
  1058. left: 60upx;
  1059. bottom: 15upx;
  1060. width: 72upx;
  1061. height: 36upx;
  1062. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABkCAYAAADDhn8LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTMyIDc5LjE1OTI4NCwgMjAxNi8wNC8xOS0xMzoxMzo0MCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OTk4MzlBNjE0NjU1MTFFOUExNjRFQ0I3RTQ0NEExQjMiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OTk4MzlBNjA0NjU1MTFFOUExNjRFQ0I3RTQ0NEExQjMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6Q0E3RUNERkE0NjExMTFFOTg5NzI4MTM2Rjg0OUQwOEUiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6Q0E3RUNERkI0NjExMTFFOTg5NzI4MTM2Rjg0OUQwOEUiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4Gh5BPAAACTUlEQVR42uzcQW7jQAwFUdN306l1uWwNww5kqdsmm6/2MwtVCp8CosQtP9vg/2+/gY+DRAMBgqnjIp2PaCxCLLldpPARRIiFj1yBbMV+cHZh9PURRLQNhY8kgWyL/WDtwujjI8hoE8rKLqb5CDJaRMJHokC6yKgSCR9JAukmokIknCQJpLOIrJFwMsBJELFcKHwM9BFkLBMKFxNcBCHlQ+FhoocgpVwwnv0Xn30QBJGMC0QcaBVJiAMiec/dcwKuL4j1QMsVCXFAJE4s4NQA3K/8Y6DzO4g40P7UcmIBJxbEesCKWBDg8wWxHrAiFgT4fEGsB/CwIhYE+AeBAAdPLOcV8HRmWRDAiQVcO7GcV8CLM8uCAE4sQCDAlHcQ7x+ABQEEAggEEAggEEAggEAAgQACASAQQCCAQACBAAIBBAIIBBAIIBBAIABe4e9iAe/xd7EAJxYgEGDeO4j3EODp/cOCAE4sYMyJ5cwCHs4rCwI4sYBxJ5YzC84rCwKcXxArAuthQYDzC2JF0H49LAhwYUGsCFqvx5EF2T07dMaJBetx4cRyaqFtHJ8EIhK0i8OJBQxcECuCVutxJhCRoE0cZwMRyRcFefa/ffZBVPogePihhyCnbBhcfMFFEFM+DD4m+ghSlgmDkwlOgpAl4+BkkJMgZdk4+EgaSCcpVX7bmY9kgXQQU+1TgE0c+QJZUUz1b2T4SBbIKmJW+3iMj2SBVBWz+leVfCQLpIqYbp8b85EskIxyfIOfK5Sf+wiCRJEsllQ+oqEkQfBxmD8BBgA5hVjXyrBNUQAAAABJRU5ErkJggg==);
  1063. background-size: 100% 100%;
  1064. .num {
  1065. width: 36upx;
  1066. height: 36upx;
  1067. border-radius: 50px;
  1068. font-size: 24upx;
  1069. color: #fff;
  1070. text-align: center;
  1071. line-height: 36upx;
  1072. }
  1073. .sign {
  1074. position: absolute;
  1075. top: 0;
  1076. left: 50%;
  1077. line-height: 36upx;
  1078. font-size: 12upx;
  1079. color: #fff;
  1080. transform: translateX(-50%);
  1081. }
  1082. }
  1083. .ad-1 {
  1084. width: 100%;
  1085. height: 210upx;
  1086. padding: 10upx 0;
  1087. background: #fff;
  1088. image {
  1089. width: 100%;
  1090. height: 100%;
  1091. }
  1092. }
  1093. /* 秒杀专区 */
  1094. .seckill-section {
  1095. padding: 4upx 30upx 24upx;
  1096. background: #fff;
  1097. .s-header {
  1098. display: flex;
  1099. align-items: center;
  1100. height: 92upx;
  1101. line-height: 1;
  1102. .s-img {
  1103. width: 140upx;
  1104. height: 30upx;
  1105. }
  1106. .tip {
  1107. font-size: $font-base;
  1108. color: $font-color-light;
  1109. margin: 0 20upx 0 40upx;
  1110. }
  1111. .timer {
  1112. display: inline-block;
  1113. width: 40upx;
  1114. height: 36upx;
  1115. text-align: center;
  1116. line-height: 36upx;
  1117. margin-right: 14upx;
  1118. font-size: $font-sm+2upx;
  1119. color: #fff;
  1120. border-radius: 2px;
  1121. background: rgba(0, 0, 0, .8);
  1122. }
  1123. .icon-you {
  1124. font-size: $font-lg;
  1125. color: $font-color-light;
  1126. flex: 1;
  1127. text-align: right;
  1128. }
  1129. }
  1130. .floor-list {
  1131. white-space: nowrap;
  1132. }
  1133. .scoll-wrapper {
  1134. display: flex;
  1135. align-items: flex-start;
  1136. }
  1137. .floor-item {
  1138. width: 150upx;
  1139. margin-right: 20upx;
  1140. font-size: $font-sm+2upx;
  1141. color: $font-color-dark;
  1142. line-height: 1.8;
  1143. image {
  1144. width: 150upx;
  1145. height: 150upx;
  1146. border-radius: 6upx;
  1147. }
  1148. .price {
  1149. color: $uni-color-primary;
  1150. }
  1151. }
  1152. }
  1153. .f-header {
  1154. display: flex;
  1155. align-items: center;
  1156. height: 100upx;
  1157. padding: 6upx 30upx 8upx;
  1158. background: #fff;
  1159. image {
  1160. flex-shrink: 0;
  1161. width: 80upx;
  1162. height: 80upx;
  1163. margin-right: 20upx;
  1164. }
  1165. .tit-box {
  1166. flex: 1;
  1167. display: flex;
  1168. }
  1169. .tit {
  1170. font-size: $font-lg +2upx;
  1171. color: #font-color-dark;
  1172. line-height: 1.3;
  1173. }
  1174. .tit2 {
  1175. font-size: $font-sm;
  1176. color: $font-color-light;
  1177. }
  1178. .icon-you {
  1179. font-size: $font-lg +2upx;
  1180. color: $font-color-light;
  1181. }
  1182. }
  1183. /* 团购楼层 */
  1184. .group-section {
  1185. background: #fff;
  1186. .g-swiper {
  1187. height: 550upx;
  1188. padding-bottom: 30upx;
  1189. }
  1190. .g-swiper-item {
  1191. width: 100%;
  1192. padding: 0 30upx;
  1193. display: flex;
  1194. }
  1195. image {
  1196. width: 100%;
  1197. height: 360upx;
  1198. border-radius: 4px;
  1199. }
  1200. .g-item {
  1201. display: flex;
  1202. flex-direction: column;
  1203. overflow: hidden;
  1204. width: 200rpx;
  1205. }
  1206. .left {
  1207. flex: 1.2;
  1208. margin-right: 24upx;
  1209. .t-box {
  1210. padding-top: 20upx;
  1211. }
  1212. }
  1213. .right {
  1214. flex: 0.8;
  1215. flex-direction: column-reverse;
  1216. .t-box {
  1217. padding-bottom: 20upx;
  1218. }
  1219. }
  1220. .t-box {
  1221. height: 160upx;
  1222. font-size: $font-base+2upx;
  1223. color: $font-color-dark;
  1224. line-height: 1.6;
  1225. }
  1226. .price {
  1227. color: $uni-color-primary;
  1228. }
  1229. .m-price {
  1230. font-size: $font-sm+2upx;
  1231. text-decoration: line-through;
  1232. color: $font-color-light;
  1233. margin-left: 8upx;
  1234. }
  1235. .pro-box {
  1236. display: flex;
  1237. align-items: center;
  1238. margin-top: 10upx;
  1239. font-size: $font-sm;
  1240. color: $font-base;
  1241. padding-right: 10upx;
  1242. }
  1243. .progress-box {
  1244. flex: 1;
  1245. border-radius: 10px;
  1246. overflow: hidden;
  1247. margin-right: 8upx;
  1248. }
  1249. }
  1250. /* 分类推荐楼层 */
  1251. .hot-floor {
  1252. width: 100%;
  1253. overflow: hidden;
  1254. margin-bottom: 20upx;
  1255. .floor-img-box {
  1256. width: 100%;
  1257. height: 320upx;
  1258. position: relative;
  1259. &:after {
  1260. content: '';
  1261. position: absolute;
  1262. left: 0;
  1263. top: 0;
  1264. width: 100%;
  1265. height: 100%;
  1266. background: linear-gradient(rgba(255, 255, 255, .06) 30%, #f8f8f8);
  1267. }
  1268. }
  1269. .floor-img {
  1270. width: 100%;
  1271. height: 100%;
  1272. }
  1273. .floor-list {
  1274. white-space: nowrap;
  1275. padding: 20upx;
  1276. padding-right: 50upx;
  1277. border-radius: 6upx;
  1278. margin-top: -140upx;
  1279. margin-left: 30upx;
  1280. background: #fff;
  1281. box-shadow: 1px 1px 5px rgba(0, 0, 0, .2);
  1282. position: relative;
  1283. z-index: 1;
  1284. }
  1285. .scoll-wrapper {
  1286. display: flex;
  1287. align-items: flex-start;
  1288. }
  1289. .floor-item {
  1290. width: 180upx;
  1291. margin-right: 20upx;
  1292. font-size: $font-sm+2upx;
  1293. color: $font-color-dark;
  1294. line-height: 1.8;
  1295. image {
  1296. width: 180upx;
  1297. height: 180upx;
  1298. border-radius: 6upx;
  1299. }
  1300. .price {
  1301. color: $uni-color-primary;
  1302. }
  1303. }
  1304. .more {
  1305. display: flex;
  1306. align-items: center;
  1307. justify-content: center;
  1308. flex-direction: column;
  1309. flex-shrink: 0;
  1310. width: 180upx;
  1311. height: 180upx;
  1312. border-radius: 6upx;
  1313. background: #f3f3f3;
  1314. font-size: $font-base;
  1315. color: $font-color-light;
  1316. text:first-child {
  1317. margin-bottom: 4upx;
  1318. }
  1319. }
  1320. }
  1321. /* 猜你喜欢 */
  1322. .guess-section {
  1323. display: flex;
  1324. flex-wrap: wrap;
  1325. padding: 0 30upx;
  1326. background: #fff;
  1327. .guess-item {
  1328. display: flex;
  1329. flex-direction: column;
  1330. width: 48%;
  1331. padding-bottom: 40upx;
  1332. &:nth-child(2n+1) {
  1333. margin-right: 4%;
  1334. }
  1335. }
  1336. .image-wrapper {
  1337. width: 100%;
  1338. height: 330upx;
  1339. border-radius: 3px;
  1340. overflow: hidden;
  1341. image {
  1342. width: 100%;
  1343. height: 100%;
  1344. opacity: 1;
  1345. }
  1346. }
  1347. .title {
  1348. font-size: $font-lg;
  1349. color: $font-color-dark;
  1350. line-height: 80upx;
  1351. }
  1352. .price {
  1353. font-size: $font-lg;
  1354. color: $uni-color-primary;
  1355. line-height: 1;
  1356. }
  1357. }
  1358. .bg-gradual-green {
  1359. background-image: linear-gradient(180deg, #86CE2C, #6db617);
  1360. color: #ffffff;
  1361. }
  1362. .coupon-box {
  1363. z-index: 99999;
  1364. position: fixed;
  1365. right: 5px;
  1366. bottom: 20px;
  1367. width: 50px;
  1368. height: 50px;
  1369. background-color: #FF5C5C;
  1370. /* 红包背景色 */
  1371. color: white;
  1372. border-radius: 10%;
  1373. /* 圆形红包 */
  1374. display: flex;
  1375. align-items: center;
  1376. justify-content: center;
  1377. font-size: 14px;
  1378. cursor: pointer;
  1379. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  1380. transition: all 0.3s ease-in-out;
  1381. }
  1382. .coupon-box.hidden {
  1383. bottom: 50px;
  1384. /* Adjust to hide half */
  1385. }
  1386. .coupon-box.transparent {
  1387. background-color: rgba(255, 92, 92, 0.5);
  1388. /* 透明度增加50% */
  1389. border-color: rgba(255, 31, 31, 0.5);
  1390. /* 边框透明 */
  1391. }
  1392. </style>