index.vue 23 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010
  1. <template>
  2. <view class="sell-container">
  3. <!-- 顶部背景图 -->
  4. <image class="top-bg-image" src="/pages-sell/static/top-bg.png" mode="widthFix"></image>
  5. <!-- 导航栏 -->
  6. <view class="custom-navbar" :style="{ paddingTop: statusBarHeight + 'px' }">
  7. <view class="navbar-content">
  8. <text class="navbar-title">书嗨</text>
  9. <!-- 右侧胶囊占位,保持布局平衡 -->
  10. <view class="nav-right-placeholder"></view>
  11. </view>
  12. </view>
  13. <!-- 主要内容区域 -->
  14. <view class="main-content" :style="{ paddingTop: (statusBarHeight + 44) + 'px' }">
  15. <!-- 顶部固定区域:导航栏背景和搜索框 -->
  16. <view class="fixed-header-area" :style="{
  17. paddingTop: statusBarHeight + 44 + 'px'
  18. }">
  19. <!-- 小程序背景图兼容:使用绝对定位的 image 替代 backgroundImage -->
  20. <image class="fixed-bg-img" v-show="scrollTop > 0" src="/pages-sell/static/top-bg.png" mode="widthFix"></image>
  21. <view class="search-wrapper" @click="navigateTo('/pages-sell/pages/search')">
  22. <view class="search-box-uview">
  23. <u-search placeholder="搜索关键字" :show-action="false" bg-color="transparent" height="40"
  24. :clearabled="true" v-model="keyword" :disabled="true"
  25. search-icon="/pages-sell/static/search-icon.png"></u-search>
  26. <view class="search-btn-overlay">
  27. <text>搜索</text>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 热搜词横向滚动区域 -->
  32. <view class="hot-search-wrapper" v-if="hotSearchList.length > 0">
  33. <view class="hot-search-fixed-title">
  34. <view class="hot-tag hot-tag-highlight" @click="navigateTo('/pages-sell/pages/search')">热搜
  35. </view>
  36. <image src="../../static/select.png" class="select-icon" mode="widthFix" style="width: 30rpx;"></image>
  37. </view>
  38. <scroll-view class="hot-search-scroll" scroll-x="true" :show-scrollbar="false">
  39. <view class="hot-search-list">
  40. <view class="hot-tag" v-for="(item, index) in hotSearchList" :key="index"
  41. @click="goSearchResult(item)">
  42. {{ item }}
  43. </view>
  44. </view>
  45. </scroll-view>
  46. </view>
  47. </view>
  48. <!-- 占位,防止内容被 fixed 区域遮挡 -->
  49. <view class="search-placeholder"></view>
  50. <!-- 顶部横幅 Banner -->
  51. <view class="top-banner-wrapper">
  52. <image src="/pages-sell/static/top-banner.png" class="top-banner-img" mode="widthFix"></image>
  53. </view>
  54. <!-- 金刚区分类图标 (2行5列) -->
  55. <view class="category-grid">
  56. <view class="grid-item" v-for="(item, index) in categoryList" :key="index"
  57. @click="handleCategory(item)">
  58. <view class="icon-circle">
  59. <image :src="item.imgUrl" class="cat-icon" mode="aspectFit"></image>
  60. </view>
  61. <text class="cat-name">{{ item.showCateName || '-' }}</text>
  62. </view>
  63. </view>
  64. <!-- 推广与热销双卡片 -->
  65. <view class="promo-dual-card">
  66. <!-- 左侧:推广卖书 -->
  67. <view class="card-left">
  68. <view class="card-content">
  69. <u-swiper :list="swiperList" :autoplay="true" :interval="3000" name="imgUrl"></u-swiper>
  70. </view>
  71. </view>
  72. <!-- 右侧:热销商品 -->
  73. <view class="card-right">
  74. <view class="right-header" @click="navigateTo('/pages-sell/pages/hot-sell')">
  75. <image src="/pages-sell/static/icon-fire.png" class="fire-icon" mode="widthFix"></image>
  76. <text class="right-title">热销商品</text>
  77. <image src="/pages-sell/static/icon-fire.png" class="fire-icon flip" mode="widthFix"></image>
  78. </view>
  79. <view class="products-container">
  80. <!-- 使用网络图片作为书的封面占位 -->
  81. <image v-for="(item, index) in bookList" :key="index" :src="item.imgUrl" class="product-cover"
  82. mode="aspectFill" @click="navigateTo(item.jumpUrl)"></image>
  83. </view>
  84. </view>
  85. </view>
  86. <!-- 健康与成长双卡片 -->
  87. <view class="info-dual-card">
  88. <swiper class="info-card-swiper" :autoplay="true" :interval="3000" :circular="true">
  89. <swiper-item v-for="(item, index) in leftBookList" :key="index">
  90. <view class="info-card bg-orange" @click="navigateTo(item.jumpUrl)">
  91. <view class="info-text-group">
  92. <text class="info-title text-orange">{{ item.showCateName }}</text>
  93. <text class="info-desc text-orange-light">{{ item.remark }}</text>
  94. </view>
  95. <image :src="item.imgUrl" class="info-icon" mode="aspectFit"
  96. style="width: 125rpx;height: 111rpx;"></image>
  97. </view>
  98. </swiper-item>
  99. </swiper>
  100. <swiper class="info-card-swiper" :autoplay="true" :interval="3500" :circular="true">
  101. <swiper-item v-for="(item, index) in rightBookList" :key="index">
  102. <view class="info-card bg-green" @click="navigateTo(item.jumpUrl)">
  103. <view class="info-text-group">
  104. <text class="info-title text-green">{{ item.showCateName }}</text>
  105. <text class="info-desc text-green-light">{{ item.remark }}</text>
  106. </view>
  107. <image :src="item.imgUrl" class="info-icon" mode="aspectFit"></image>
  108. </view>
  109. </swiper-item>
  110. </swiper>
  111. </view>
  112. <!-- 公众号横幅 -->
  113. <view class="gzh-section" @click="navigateToOfficialAccount">
  114. <view class="gzh-bg-wrapper">
  115. <image src="/pages-sell/static/gzh-banner.png" class="gzh-img-bg" mode="aspectFill"></image>
  116. <view class="gzh-content-overlay">
  117. <text class="gzh-title">关注公众号 ,定期领红包</text>
  118. <view class="gzh-subtitle-pill">
  119. <text class="gzh-subtitle">别让好书蒙尘 ,书嗨陪你逐页品读</text>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. <!-- 书嗨推荐 -->
  125. <view class="recommend-section" @click="navigateTo(item.jumpUrl)" v-for="(item, index) in topicList"
  126. :key="index">
  127. <view class="section-header">
  128. <text class="section-title">{{ item.showCateName }}</text>
  129. <view class="view-more">
  130. <text>查看全部</text>
  131. <image src="/pages-sell/static/right-arrow.png" class="arrow-icon" mode="widthFix"></image>
  132. </view>
  133. </view>
  134. <view class="book-list">
  135. <view class="book-item" v-for="(book, index) in getDisplayBooks(item)" :key="index"
  136. @click.stop="navigateTo('/pages-sell/pages/detail?isbn=' + book.bookIsbn)">
  137. <image :src="book.bookImg" class="book-image" mode="aspectFill"></image>
  138. <text class="book-name">{{ book.bookName }}</text>
  139. <view class="price-row">
  140. <text class="currency">¥</text>
  141. <text class="price-val">{{ book.bookPrice }}</text>
  142. <text class="price-old">¥{{ book.bookOriginalPrice }}</text>
  143. </view>
  144. <view class="add-btn">
  145. <text>加入购物车</text>
  146. <image src="/pages-sell/static/shape-10.png" class="cart-symbol"></image>
  147. </view>
  148. </view>
  149. </view>
  150. </view>
  151. <!-- 底部留白,防止遮挡 -->
  152. <view class="bottom-safe-area"></view>
  153. </view>
  154. <!-- 分享红包悬浮按钮 -->
  155. <FloatingDrag :width="126" :height="140" :initial-position="redPacketPosition"
  156. @position-change="handleRedPacketPositionChange" v-if="shareList.length > 0">
  157. <button class="red-packet-btn" @click="navigateToRedPacket">
  158. <image src="/packet/static/index/btn_share.png" mode="widthFix" style="width: 126rpx; height: 140rpx">
  159. </image>
  160. </button>
  161. </FloatingDrag>
  162. <!-- 客服悬浮按钮 -->
  163. <FloatingDrag :width="126" :height="140" :initial-position="servicePosition"
  164. @position-change="handleServicePositionChange"
  165. @drag-start="handleDragStart"
  166. @drag-end="handleDragEnd">
  167. <!-- #ifdef MP-ALIPAY -->
  168. <button class="service-btn" @click="navigateToCustomerService">
  169. <image src="/static/img/kf.png" class="cs-icon" mode="aspectFit"></image>
  170. </button>
  171. <!-- #endif -->
  172. <!-- #ifndef MP-ALIPAY -->
  173. <button class="service-btn" open-type="contact">
  174. <image src="/static/img/kf.png" class="cs-icon" mode="aspectFit"></image>
  175. </button>
  176. <!-- #endif -->
  177. </FloatingDrag>
  178. </view>
  179. </template>
  180. <script>
  181. import FloatingDrag from "@/components/floating-drag.vue";
  182. export default {
  183. name: 'SellContainer',
  184. components: {
  185. FloatingDrag
  186. },
  187. data() {
  188. return {
  189. // 红包悬浮按钮位置
  190. redPacketPosition: {
  191. left: 'auto',
  192. right: 0,
  193. bottom: '15%',
  194. },
  195. // 客服悬浮按钮位置
  196. servicePosition: {
  197. left: 'auto',
  198. right: 0,
  199. bottom: '30%',
  200. },
  201. isDragging: false, // 是否正在拖动悬浮按钮
  202. barStyle: {
  203. backgroundColor: 'transparent',
  204. background: "url('/pages-sell/static/tab-selected.png') no-repeat center",
  205. backgroundSize: '100% 100%',
  206. position: 'relative',
  207. top: '-6rpx',
  208. },
  209. swiperList: [],
  210. statusBarHeight: 20,
  211. keyword: '',
  212. // 记录滚动距离以实现背景错位效果
  213. scrollTop: 0,
  214. // u-tabs 需要对象数组 [{name: 'xxx'}]
  215. hotTagList: [
  216. { name: '热搜' },
  217. { name: '励志' },
  218. { name: '绘本' },
  219. { name: '诺贝尔文学奖' },
  220. { name: '茅盾奖' },
  221. { name: '童书' }
  222. ],
  223. currentHotTag: 0,
  224. // 临时的网络书封面图片
  225. bookCoverUrl: 'https://img.yzcdn.cn/vant/cat.jpeg',
  226. categoryList: [], //金刚区
  227. bookList: [], // 右侧推荐书籍
  228. recommendBooks: [
  229. { title: '山河岁月', price: '6.80', original: '36.80', cover: 'https://img.yzcdn.cn/vant/cat.jpeg' },
  230. { title: '山河岁月', price: '6.80', original: '36.80', cover: 'https://img.yzcdn.cn/vant/cat.jpeg' },
  231. { title: '山河岁月', price: '6.80', original: '36.80', cover: 'https://img.yzcdn.cn/vant/cat.jpeg' }
  232. ],
  233. topicList: [], //专题推荐
  234. leftBookList: [], // 左侧推荐书籍
  235. rightBookList: [], // 右侧推荐书籍
  236. shareList: [], // 分享列表
  237. hotSearchList: [] // 存放热搜词
  238. }
  239. },
  240. created() {
  241. const systemInfo = uni.getSystemInfoSync();
  242. this.statusBarHeight = systemInfo.statusBarHeight || 20;
  243. this.hasShareList()
  244. this.getIndexCateInfo()
  245. this.getHotSearchData()
  246. },
  247. methods: {
  248. async getHotSearchData() {
  249. try {
  250. const res = await this.$u.api.getHotSearchListAjax();
  251. if (res.code === 200 || res.code === 0) {
  252. this.hotSearchList = res.data || [];
  253. }
  254. } catch (error) {
  255. console.log('获取热搜词失败', error);
  256. }
  257. },
  258. goSearchResult(keyword) {
  259. if (!keyword) return;
  260. // 过滤可能带有的 <em> 等后端返回的 HTML 标签
  261. const cleanKey = keyword.replace(/<[^>]+>/g, '');
  262. uni.navigateTo({
  263. url: '/pages-sell/pages/search-result?keyword=' + encodeURIComponent(cleanKey)
  264. });
  265. },
  266. // 接收外部传入的页面滚动事件
  267. onPageScroll(scrollTop) {
  268. if (this.isDragging) return; // 拖动悬浮按钮时禁止滚动
  269. this.scrollTop = scrollTop || 0;
  270. console.log(this.scrollTop)
  271. },
  272. async hasShareList() {
  273. const res = await this.$u.api.getShareRedBagListAjax();
  274. if (res.code === 200 || res.code === 0) {
  275. this.shareList = res.data || [];
  276. }
  277. },
  278. handleCategory(item) {
  279. if (!item.jumpUrl) return
  280. this.navigateTo(item.jumpUrl)
  281. },
  282. changeHotTag(index) {
  283. this.currentHotTag = index;
  284. console.log('切换标签:', index);
  285. },
  286. //跳转 URL
  287. navigateTo(url) {
  288. if (!url) return
  289. console.log(url)
  290. uni.navigateTo({
  291. url: url
  292. });
  293. },
  294. navigateToOfficialAccount() {
  295. // 打开公众号
  296. uni.getProvider({
  297. service: "oauth",
  298. success: function (res) {
  299. if (res.provider.includes("weixin")) {
  300. // 调用微信小程序的 wx.openOfficialAccountProfile
  301. wx.openOfficialAccountProfile({
  302. username: "bookersea",
  303. success: function (res) {
  304. console.log("打开公众号资料页成功", res);
  305. },
  306. fail: function (err) {
  307. console.log("打开公众号资料页失败", err);
  308. },
  309. complete: function () {
  310. console.log("接口调用结束");
  311. },
  312. });
  313. }
  314. },
  315. });
  316. },
  317. goRecommend() {
  318. uni.navigateTo({
  319. url: '/pages-sell/pages/recommend'
  320. });
  321. },
  322. goHotSell() {
  323. uni.navigateTo({
  324. url: '/pages-sell/pages/hot-sell'
  325. });
  326. },
  327. //获取首页装修信息
  328. getIndexCateInfo() {
  329. uni.$u.http.get('/token/shop/showIndex/getIndexCateInfo').then(res => {
  330. console.log(res)
  331. if (res.code == 200) {
  332. console.log(res.data)
  333. this.categoryList = res.data.find(item => item.position == 'diamond_area')?.shopIndexCateVo || []
  334. this.swiperList = res.data.find(item => item.position == 'left_banner')?.shopIndexCateVo || []
  335. this.bookList = res.data.find(item => item.position == 'right_banner')?.shopIndexCateVo || []
  336. this.leftBookList = res.data.find(item => item.position == 'left_book_list')?.shopIndexCateVo || []
  337. this.rightBookList = res.data.find(item => item.position == 'right_book_list')?.shopIndexCateVo || []
  338. //获取专题推荐
  339. this.topicList = res.data.find(item => item.position == 'topic')?.shopIndexCateVo || []
  340. }
  341. })
  342. },
  343. getDisplayBooks(item) {
  344. if (!item.bookInfoList) return []
  345. let limit = 3
  346. if (item.topicType === 2) {
  347. limit = 6
  348. }
  349. return item.bookInfoList.slice(0, limit)
  350. },
  351. // 跳转到红包分享页面
  352. navigateToRedPacket() {
  353. uni.navigateTo({
  354. url: '/packet/pages/share'
  355. });
  356. },
  357. // 红包按钮位置变化
  358. handleRedPacketPositionChange(position) {
  359. this.redPacketPosition = position;
  360. },
  361. // 客服按钮位置变化
  362. handleServicePositionChange(position) {
  363. this.servicePosition = position;
  364. },
  365. // 拖动开始
  366. handleDragStart() {
  367. this.isDragging = true;
  368. },
  369. // 拖动结束
  370. handleDragEnd() {
  371. this.isDragging = false;
  372. },
  373. // 支付宝小程序的客服
  374. navigateToCustomerService() {
  375. uni.makePhoneCall({
  376. phoneNumber: '400-123-4567'
  377. });
  378. }
  379. }
  380. }
  381. </script>
  382. <style lang="scss" scoped>
  383. .sell-container {
  384. position: relative;
  385. min-height: 100vh;
  386. background-color: #F6F6F6;
  387. overflow-x: hidden;
  388. }
  389. /* 顶部大背景图 */
  390. .top-bg-image {
  391. position: absolute;
  392. top: 0;
  393. left: 0;
  394. width: 100%;
  395. z-index: 0;
  396. display: block;
  397. }
  398. /* 导航栏 */
  399. .custom-navbar {
  400. position: fixed;
  401. top: 0;
  402. left: 0;
  403. width: 100%;
  404. z-index: 100;
  405. display: flex;
  406. align-items: center;
  407. justify-content: center;
  408. .navbar-content {
  409. height: 44px;
  410. width: 100%;
  411. display: flex;
  412. align-items: center;
  413. justify-content: center;
  414. position: relative;
  415. .navbar-title {
  416. color: #fff;
  417. font-size: 36rpx;
  418. font-weight: 600;
  419. }
  420. }
  421. }
  422. .main-content {
  423. position: relative;
  424. z-index: 1;
  425. padding: 0 24rpx;
  426. }
  427. /* 顶部固定区域:背景和搜索框 */
  428. .fixed-header-area {
  429. position: fixed;
  430. top: 0;
  431. left: 0;
  432. width: 100%;
  433. z-index: 99;
  434. padding-left: 24rpx;
  435. padding-right: 24rpx;
  436. padding-bottom: 16rpx;
  437. box-sizing: border-box;
  438. transition: background-color 0.2s;
  439. overflow: hidden;
  440. }
  441. .fixed-bg-img {
  442. position: absolute;
  443. top: 0;
  444. left: 0;
  445. width: 100%;
  446. z-index: -1;
  447. display: block;
  448. }
  449. .search-placeholder {
  450. height: 160rpx;
  451. /* 增加高度以容纳热搜词 */
  452. }
  453. /* 热搜词横向滚动 */
  454. .hot-search-wrapper {
  455. margin-bottom: 24rpx;
  456. width: 100%;
  457. display: flex;
  458. align-items: center;
  459. }
  460. .hot-search-fixed-title {
  461. flex-shrink: 0;
  462. padding-left: 24rpx;
  463. position: relative;
  464. .select-icon {
  465. position: absolute;
  466. top: 36rpx;
  467. left: 50%;
  468. transform: translateX(-50%);
  469. }
  470. }
  471. .hot-search-scroll {
  472. flex: 1;
  473. white-space: nowrap;
  474. overflow: hidden;
  475. }
  476. .hot-search-list {
  477. display: inline-flex;
  478. align-items: center;
  479. padding: 0 20rpx;
  480. }
  481. .hot-tag {
  482. display: inline-block;
  483. margin-right: 30rpx;
  484. font-size: 26rpx;
  485. color: #666;
  486. font-weight: 500;
  487. }
  488. .hot-tag-highlight {
  489. color: #38C148;
  490. font-weight: bold;
  491. padding-right: 20rpx;
  492. margin-right: 0;
  493. position: relative;
  494. }
  495. .hot-tag-highlight::after {
  496. content: '';
  497. position: absolute;
  498. right: 0;
  499. top: 50%;
  500. transform: translateY(-50%);
  501. width: 2rpx;
  502. height: 24rpx;
  503. background-color: #E0E0E0;
  504. }
  505. /* 搜索框 */
  506. .search-wrapper {
  507. margin-top: 10rpx;
  508. margin-bottom: 20rpx;
  509. .search-box-uview {
  510. height: 80rpx;
  511. background-color: #fff;
  512. border-radius: 40rpx;
  513. display: flex;
  514. align-items: center;
  515. padding: 0 10rpx 0 16rpx;
  516. position: relative;
  517. /* 覆盖 u-search 的 padding 以适配 */
  518. ::v-deep .u-search {
  519. flex: 1;
  520. /* 让输入框不遮挡右侧按钮 */
  521. padding-right: 140rpx !important;
  522. }
  523. .search-btn-overlay {
  524. position: absolute;
  525. right: 8rpx;
  526. top: 50%;
  527. transform: translateY(-50%);
  528. width: 140rpx;
  529. height: 64rpx;
  530. background: linear-gradient(0deg, #37C148 0%, #6ADD83 100%);
  531. border-radius: 32rpx;
  532. display: flex;
  533. align-items: center;
  534. justify-content: center;
  535. z-index: 2;
  536. text {
  537. color: #fff;
  538. font-size: 28rpx;
  539. font-weight: 500;
  540. }
  541. }
  542. }
  543. }
  544. /* 顶部横幅 */
  545. .top-banner-wrapper {
  546. width: 100%;
  547. margin-bottom: 30rpx;
  548. position: relative;
  549. .top-banner-img {
  550. width: 100%;
  551. border-radius: 40rpx;
  552. display: block;
  553. }
  554. }
  555. /* 分类图标 */
  556. .category-grid {
  557. display: flex;
  558. flex-wrap: wrap;
  559. margin-bottom: 10rpx;
  560. .grid-item {
  561. width: 20%;
  562. display: flex;
  563. flex-direction: column;
  564. align-items: center;
  565. margin-bottom: 30rpx;
  566. .icon-circle {
  567. width: 96rpx;
  568. height: 96rpx;
  569. display: flex;
  570. align-items: center;
  571. justify-content: center;
  572. margin-bottom: 12rpx;
  573. .cat-icon {
  574. width: 100%;
  575. height: 100%;
  576. }
  577. }
  578. .cat-name {
  579. font-size: 24rpx;
  580. color: #333;
  581. font-weight: 500;
  582. }
  583. }
  584. }
  585. /* 推广双卡片 */
  586. .promo-dual-card {
  587. display: flex;
  588. justify-content: space-between;
  589. margin-bottom: 24rpx;
  590. .card-left {
  591. width: 48%;
  592. height: 252rpx;
  593. border-radius: 20rpx;
  594. position: relative;
  595. overflow: hidden;
  596. }
  597. .card-right {
  598. width: 48%;
  599. height: 252rpx;
  600. /* Updated background per request */
  601. background: linear-gradient(to bottom, #FFD7C3 0%, #FFFFFF 32%);
  602. border-radius: 20rpx;
  603. padding: 20rpx;
  604. box-sizing: border-box;
  605. .right-header {
  606. display: flex;
  607. align-items: center;
  608. justify-content: center;
  609. margin-bottom: 20rpx;
  610. .right-title {
  611. font-size: 30rpx;
  612. font-weight: bold;
  613. color: #333;
  614. margin: 0 10rpx;
  615. }
  616. .fire-icon {
  617. width: 30rpx;
  618. height: 30rpx;
  619. }
  620. .flip {
  621. transform: scaleX(-1);
  622. }
  623. }
  624. .products-container {
  625. display: flex;
  626. justify-content: space-between;
  627. gap: 20rpx;
  628. .product-cover {
  629. flex: 1;
  630. height: 160rpx;
  631. border-radius: 12rpx;
  632. background-color: #f0f0f0;
  633. }
  634. }
  635. }
  636. }
  637. /* 信息双卡片 */
  638. .info-dual-card {
  639. display: flex;
  640. justify-content: space-between;
  641. margin-bottom: 24rpx;
  642. .info-card-swiper {
  643. width: 48%;
  644. height: 140rpx;
  645. border-radius: 12px;
  646. overflow: hidden;
  647. }
  648. .info-card {
  649. width: 100%;
  650. padding: 24rpx;
  651. border-radius: 12px;
  652. /* Updated radius */
  653. display: flex;
  654. justify-content: space-between;
  655. align-items: center;
  656. height: 140rpx;
  657. box-sizing: border-box;
  658. position: relative;
  659. /* For absolute icon */
  660. overflow: hidden;
  661. &.bg-orange {
  662. background: #FFF3E0;
  663. border: 1px solid #FFB72A;
  664. }
  665. &.bg-green {
  666. background: #D4F1D8;
  667. border: 1px solid #54A94E;
  668. }
  669. .info-text-group {
  670. flex: 1;
  671. z-index: 1;
  672. /* Ensure text is above */
  673. .info-title {
  674. font-size: 28rpx;
  675. font-weight: bold;
  676. display: block;
  677. margin-bottom: 6rpx;
  678. }
  679. .info-desc {
  680. font-size: 22rpx;
  681. line-height: 1.2;
  682. }
  683. .text-orange {
  684. color: #DB832D;
  685. }
  686. .text-orange-light {
  687. color: #DB832D;
  688. display: inline-block;
  689. width: 90%;
  690. //超出部分省略号显示
  691. overflow: hidden;
  692. white-space: nowrap;
  693. text-overflow: ellipsis;
  694. max-width: 200rpx;
  695. }
  696. .text-green {
  697. color: #1F8049;
  698. }
  699. .text-green-light {
  700. color: #1F8049;
  701. display: inline-block;
  702. width: 90%;
  703. //超出部分省略号显示
  704. overflow: hidden;
  705. white-space: nowrap;
  706. text-overflow: ellipsis;
  707. max-width: 200rpx;
  708. }
  709. }
  710. .info-icon {
  711. width: 100rpx;
  712. /* Slightly larger maybe */
  713. height: 100rpx;
  714. position: absolute;
  715. right: 0;
  716. bottom: 0;
  717. z-index: 0;
  718. opacity: 0.8;
  719. }
  720. }
  721. }
  722. /* 公众号 */
  723. .gzh-section {
  724. margin-bottom: 30rpx;
  725. height: 180rpx;
  726. /* Fixed height for consistency */
  727. border-radius: 20rpx;
  728. overflow: hidden;
  729. .gzh-bg-wrapper {
  730. width: 100%;
  731. height: 100%;
  732. position: relative;
  733. .gzh-img-bg {
  734. width: 100%;
  735. height: 100%;
  736. position: absolute;
  737. top: 0;
  738. left: 0;
  739. }
  740. .gzh-content-overlay {
  741. position: absolute;
  742. top: 0;
  743. left: 0;
  744. width: 60%;
  745. /* Only cover left side */
  746. height: 100%;
  747. padding: 30rpx;
  748. display: flex;
  749. flex-direction: column;
  750. justify-content: center;
  751. .gzh-title {
  752. font-size: 32rpx;
  753. font-weight: bold;
  754. color: #134E13;
  755. /* Dark green */
  756. margin-bottom: 16rpx;
  757. }
  758. .gzh-subtitle-pill {
  759. background: #FFF;
  760. border-radius: 24rpx;
  761. padding: 0 14rpx;
  762. line-height: 1.4;
  763. align-self: flex-start;
  764. .gzh-subtitle {
  765. font-size: 22rpx;
  766. color: #134E13;
  767. font-weight: 500;
  768. }
  769. }
  770. }
  771. }
  772. }
  773. /* 书嗨推荐 */
  774. .recommend-section {
  775. background-color: #fff;
  776. border-radius: 20rpx;
  777. padding: 30rpx;
  778. margin-bottom: 24rpx;
  779. .section-header {
  780. display: flex;
  781. justify-content: space-between;
  782. align-items: center;
  783. margin-bottom: 24rpx;
  784. .section-title {
  785. font-size: 32rpx;
  786. font-weight: bold;
  787. color: #333;
  788. }
  789. .view-more {
  790. display: flex;
  791. align-items: center;
  792. font-size: 24rpx;
  793. color: #8D8D8D;
  794. .arrow-icon {
  795. width: 12rpx;
  796. margin-left: 6rpx;
  797. }
  798. }
  799. }
  800. .book-list {
  801. display: flex;
  802. flex-wrap: wrap;
  803. justify-content: space-between;
  804. }
  805. .book-item {
  806. width: 200rpx;
  807. margin-bottom: 24rpx;
  808. display: flex;
  809. flex-direction: column;
  810. .book-image {
  811. width: 200rpx;
  812. height: 255rpx;
  813. border-radius: 2rpx;
  814. margin-bottom: 16rpx;
  815. background-color: #f9f9f9;
  816. }
  817. .book-name {
  818. font-family: 'Source Han Sans SC';
  819. font-weight: bold;
  820. font-size: 28rpx;
  821. color: #303030;
  822. margin-bottom: 10rpx;
  823. overflow: hidden;
  824. text-overflow: ellipsis;
  825. white-space: nowrap;
  826. }
  827. .price-row {
  828. display: flex;
  829. align-items: baseline;
  830. margin-bottom: 12rpx;
  831. .currency {
  832. font-family: 'Source Han Sans SC';
  833. font-weight: 500;
  834. font-size: 22rpx;
  835. color: #D81A00;
  836. }
  837. .price-val {
  838. font-family: 'Source Han Sans SC';
  839. font-weight: 500;
  840. font-size: 28rpx;
  841. color: #D81A00;
  842. margin-right: 12rpx;
  843. }
  844. .price-old {
  845. font-family: 'Source Han Sans SC';
  846. font-weight: 500;
  847. font-size: 22rpx;
  848. color: #999999;
  849. text-decoration: line-through;
  850. }
  851. }
  852. .add-btn {
  853. width: fit-content;
  854. height: 36rpx;
  855. line-height: 36rpx;
  856. background: linear-gradient(0deg, #4ED964 0%, #4ED964 100%);
  857. border-radius: 18rpx;
  858. padding: 0 20rpx;
  859. display: flex;
  860. align-items: center;
  861. justify-content: center;
  862. text {
  863. font-size: 22rpx;
  864. color: #fff;
  865. }
  866. .cart-symbol {
  867. width: 24rpx;
  868. height: 24rpx;
  869. margin-left: 6rpx;
  870. }
  871. }
  872. }
  873. }
  874. .bottom-safe-area {
  875. height: 30rpx
  876. }
  877. .red-packet-btn {
  878. width: 126rpx;
  879. height: 140rpx;
  880. background: transparent;
  881. border: none;
  882. padding: 0;
  883. margin: 0;
  884. display: flex;
  885. align-items: center;
  886. justify-content: center;
  887. &::after {
  888. border: none;
  889. }
  890. }
  891. /* 客服悬浮按钮 */
  892. .service-btn {
  893. width: 126rpx;
  894. height: 140rpx;
  895. background: transparent;
  896. border: none;
  897. padding: 0;
  898. margin: 0;
  899. display: flex;
  900. align-items: center;
  901. justify-content: center;
  902. &::after {
  903. border: none;
  904. }
  905. .cs-icon {
  906. width: 126rpx;
  907. height: 140rpx;
  908. }
  909. }
  910. </style>