index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020
  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" @click="handleSwiperClick"></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. handleSwiperClick(index) {
  381. const item = this.swiperList[index];
  382. console.log(item,'xxxx')
  383. if (item && item.jumpUrl) {
  384. uni.navigateTo({
  385. url: item.jumpUrl
  386. });
  387. }
  388. }
  389. }
  390. }
  391. </script>
  392. <style lang="scss" scoped>
  393. .sell-container {
  394. position: relative;
  395. min-height: 100vh;
  396. background-color: #F6F6F6;
  397. overflow-x: hidden;
  398. }
  399. /* 顶部大背景图 */
  400. .top-bg-image {
  401. position: absolute;
  402. top: 0;
  403. left: 0;
  404. width: 100%;
  405. z-index: 0;
  406. display: block;
  407. }
  408. /* 导航栏 */
  409. .custom-navbar {
  410. position: fixed;
  411. top: 0;
  412. left: 0;
  413. width: 100%;
  414. z-index: 100;
  415. display: flex;
  416. align-items: center;
  417. justify-content: center;
  418. .navbar-content {
  419. height: 44px;
  420. width: 100%;
  421. display: flex;
  422. align-items: center;
  423. justify-content: center;
  424. position: relative;
  425. .navbar-title {
  426. color: #fff;
  427. font-size: 36rpx;
  428. font-weight: 600;
  429. }
  430. }
  431. }
  432. .main-content {
  433. position: relative;
  434. z-index: 1;
  435. padding: 0 24rpx;
  436. }
  437. /* 顶部固定区域:背景和搜索框 */
  438. .fixed-header-area {
  439. position: fixed;
  440. top: 0;
  441. left: 0;
  442. width: 100%;
  443. z-index: 99;
  444. padding-left: 24rpx;
  445. padding-right: 24rpx;
  446. padding-bottom: 16rpx;
  447. box-sizing: border-box;
  448. transition: background-color 0.2s;
  449. overflow: hidden;
  450. }
  451. .fixed-bg-img {
  452. position: absolute;
  453. top: 0;
  454. left: 0;
  455. width: 100%;
  456. z-index: -1;
  457. display: block;
  458. }
  459. .search-placeholder {
  460. height: 160rpx;
  461. /* 增加高度以容纳热搜词 */
  462. }
  463. /* 热搜词横向滚动 */
  464. .hot-search-wrapper {
  465. margin-bottom: 24rpx;
  466. width: 100%;
  467. display: flex;
  468. align-items: center;
  469. }
  470. .hot-search-fixed-title {
  471. flex-shrink: 0;
  472. padding-left: 24rpx;
  473. position: relative;
  474. .select-icon {
  475. position: absolute;
  476. top: 36rpx;
  477. left: 50%;
  478. transform: translateX(-50%);
  479. }
  480. }
  481. .hot-search-scroll {
  482. flex: 1;
  483. white-space: nowrap;
  484. overflow: hidden;
  485. }
  486. .hot-search-list {
  487. display: inline-flex;
  488. align-items: center;
  489. padding: 0 20rpx;
  490. }
  491. .hot-tag {
  492. display: inline-block;
  493. margin-right: 30rpx;
  494. font-size: 26rpx;
  495. color: #666;
  496. font-weight: 500;
  497. }
  498. .hot-tag-highlight {
  499. color: #38C148;
  500. font-weight: bold;
  501. padding-right: 20rpx;
  502. margin-right: 0;
  503. position: relative;
  504. }
  505. .hot-tag-highlight::after {
  506. content: '';
  507. position: absolute;
  508. right: 0;
  509. top: 50%;
  510. transform: translateY(-50%);
  511. width: 2rpx;
  512. height: 24rpx;
  513. background-color: #E0E0E0;
  514. }
  515. /* 搜索框 */
  516. .search-wrapper {
  517. margin-top: 10rpx;
  518. margin-bottom: 20rpx;
  519. .search-box-uview {
  520. height: 80rpx;
  521. background-color: #fff;
  522. border-radius: 40rpx;
  523. display: flex;
  524. align-items: center;
  525. padding: 0 10rpx 0 16rpx;
  526. position: relative;
  527. /* 覆盖 u-search 的 padding 以适配 */
  528. ::v-deep .u-search {
  529. flex: 1;
  530. /* 让输入框不遮挡右侧按钮 */
  531. padding-right: 140rpx !important;
  532. }
  533. .search-btn-overlay {
  534. position: absolute;
  535. right: 8rpx;
  536. top: 50%;
  537. transform: translateY(-50%);
  538. width: 140rpx;
  539. height: 64rpx;
  540. background: linear-gradient(0deg, #37C148 0%, #6ADD83 100%);
  541. border-radius: 32rpx;
  542. display: flex;
  543. align-items: center;
  544. justify-content: center;
  545. z-index: 2;
  546. text {
  547. color: #fff;
  548. font-size: 28rpx;
  549. font-weight: 500;
  550. }
  551. }
  552. }
  553. }
  554. /* 顶部横幅 */
  555. .top-banner-wrapper {
  556. width: 100%;
  557. margin-bottom: 30rpx;
  558. position: relative;
  559. .top-banner-img {
  560. width: 100%;
  561. border-radius: 40rpx;
  562. display: block;
  563. }
  564. }
  565. /* 分类图标 */
  566. .category-grid {
  567. display: flex;
  568. flex-wrap: wrap;
  569. margin-bottom: 10rpx;
  570. .grid-item {
  571. width: 20%;
  572. display: flex;
  573. flex-direction: column;
  574. align-items: center;
  575. margin-bottom: 30rpx;
  576. .icon-circle {
  577. width: 96rpx;
  578. height: 96rpx;
  579. display: flex;
  580. align-items: center;
  581. justify-content: center;
  582. margin-bottom: 12rpx;
  583. .cat-icon {
  584. width: 100%;
  585. height: 100%;
  586. }
  587. }
  588. .cat-name {
  589. font-size: 24rpx;
  590. color: #333;
  591. font-weight: 500;
  592. }
  593. }
  594. }
  595. /* 推广双卡片 */
  596. .promo-dual-card {
  597. display: flex;
  598. justify-content: space-between;
  599. margin-bottom: 24rpx;
  600. .card-left {
  601. width: 48%;
  602. height: 252rpx;
  603. border-radius: 20rpx;
  604. position: relative;
  605. overflow: hidden;
  606. }
  607. .card-right {
  608. width: 48%;
  609. height: 252rpx;
  610. /* Updated background per request */
  611. background: linear-gradient(to bottom, #FFD7C3 0%, #FFFFFF 32%);
  612. border-radius: 20rpx;
  613. padding: 20rpx;
  614. box-sizing: border-box;
  615. .right-header {
  616. display: flex;
  617. align-items: center;
  618. justify-content: center;
  619. margin-bottom: 20rpx;
  620. .right-title {
  621. font-size: 30rpx;
  622. font-weight: bold;
  623. color: #333;
  624. margin: 0 10rpx;
  625. }
  626. .fire-icon {
  627. width: 30rpx;
  628. height: 30rpx;
  629. }
  630. .flip {
  631. transform: scaleX(-1);
  632. }
  633. }
  634. .products-container {
  635. display: flex;
  636. justify-content: space-between;
  637. gap: 20rpx;
  638. .product-cover {
  639. flex: 1;
  640. height: 160rpx;
  641. border-radius: 12rpx;
  642. background-color: #f0f0f0;
  643. }
  644. }
  645. }
  646. }
  647. /* 信息双卡片 */
  648. .info-dual-card {
  649. display: flex;
  650. justify-content: space-between;
  651. margin-bottom: 24rpx;
  652. .info-card-swiper {
  653. width: 48%;
  654. height: 140rpx;
  655. border-radius: 12px;
  656. overflow: hidden;
  657. }
  658. .info-card {
  659. width: 100%;
  660. padding: 24rpx;
  661. border-radius: 12px;
  662. /* Updated radius */
  663. display: flex;
  664. justify-content: space-between;
  665. align-items: center;
  666. height: 140rpx;
  667. box-sizing: border-box;
  668. position: relative;
  669. /* For absolute icon */
  670. overflow: hidden;
  671. &.bg-orange {
  672. background: #FFF3E0;
  673. border: 1px solid #FFB72A;
  674. }
  675. &.bg-green {
  676. background: #D4F1D8;
  677. border: 1px solid #54A94E;
  678. }
  679. .info-text-group {
  680. flex: 1;
  681. z-index: 1;
  682. /* Ensure text is above */
  683. .info-title {
  684. font-size: 28rpx;
  685. font-weight: bold;
  686. display: block;
  687. margin-bottom: 6rpx;
  688. }
  689. .info-desc {
  690. font-size: 22rpx;
  691. line-height: 1.2;
  692. }
  693. .text-orange {
  694. color: #DB832D;
  695. }
  696. .text-orange-light {
  697. color: #DB832D;
  698. display: inline-block;
  699. width: 90%;
  700. //超出部分省略号显示
  701. overflow: hidden;
  702. white-space: nowrap;
  703. text-overflow: ellipsis;
  704. max-width: 200rpx;
  705. }
  706. .text-green {
  707. color: #1F8049;
  708. }
  709. .text-green-light {
  710. color: #1F8049;
  711. display: inline-block;
  712. width: 90%;
  713. //超出部分省略号显示
  714. overflow: hidden;
  715. white-space: nowrap;
  716. text-overflow: ellipsis;
  717. max-width: 200rpx;
  718. }
  719. }
  720. .info-icon {
  721. width: 100rpx;
  722. /* Slightly larger maybe */
  723. height: 100rpx;
  724. position: absolute;
  725. right: 0;
  726. bottom: 0;
  727. z-index: 0;
  728. opacity: 0.8;
  729. }
  730. }
  731. }
  732. /* 公众号 */
  733. .gzh-section {
  734. margin-bottom: 30rpx;
  735. height: 180rpx;
  736. /* Fixed height for consistency */
  737. border-radius: 20rpx;
  738. overflow: hidden;
  739. .gzh-bg-wrapper {
  740. width: 100%;
  741. height: 100%;
  742. position: relative;
  743. .gzh-img-bg {
  744. width: 100%;
  745. height: 100%;
  746. position: absolute;
  747. top: 0;
  748. left: 0;
  749. }
  750. .gzh-content-overlay {
  751. position: absolute;
  752. top: 0;
  753. left: 0;
  754. width: 60%;
  755. /* Only cover left side */
  756. height: 100%;
  757. padding: 30rpx;
  758. display: flex;
  759. flex-direction: column;
  760. justify-content: center;
  761. .gzh-title {
  762. font-size: 32rpx;
  763. font-weight: bold;
  764. color: #134E13;
  765. /* Dark green */
  766. margin-bottom: 16rpx;
  767. }
  768. .gzh-subtitle-pill {
  769. background: #FFF;
  770. border-radius: 24rpx;
  771. padding: 0 14rpx;
  772. line-height: 1.4;
  773. align-self: flex-start;
  774. .gzh-subtitle {
  775. font-size: 22rpx;
  776. color: #134E13;
  777. font-weight: 500;
  778. }
  779. }
  780. }
  781. }
  782. }
  783. /* 书嗨推荐 */
  784. .recommend-section {
  785. background-color: #fff;
  786. border-radius: 20rpx;
  787. padding: 30rpx;
  788. margin-bottom: 24rpx;
  789. .section-header {
  790. display: flex;
  791. justify-content: space-between;
  792. align-items: center;
  793. margin-bottom: 24rpx;
  794. .section-title {
  795. font-size: 32rpx;
  796. font-weight: bold;
  797. color: #333;
  798. }
  799. .view-more {
  800. display: flex;
  801. align-items: center;
  802. font-size: 24rpx;
  803. color: #8D8D8D;
  804. .arrow-icon {
  805. width: 12rpx;
  806. margin-left: 6rpx;
  807. }
  808. }
  809. }
  810. .book-list {
  811. display: flex;
  812. flex-wrap: wrap;
  813. justify-content: space-between;
  814. }
  815. .book-item {
  816. width: 200rpx;
  817. margin-bottom: 24rpx;
  818. display: flex;
  819. flex-direction: column;
  820. .book-image {
  821. width: 200rpx;
  822. height: 255rpx;
  823. border-radius: 2rpx;
  824. margin-bottom: 16rpx;
  825. background-color: #f9f9f9;
  826. }
  827. .book-name {
  828. font-family: 'Source Han Sans SC';
  829. font-weight: bold;
  830. font-size: 28rpx;
  831. color: #303030;
  832. margin-bottom: 10rpx;
  833. overflow: hidden;
  834. text-overflow: ellipsis;
  835. white-space: nowrap;
  836. }
  837. .price-row {
  838. display: flex;
  839. align-items: baseline;
  840. margin-bottom: 12rpx;
  841. .currency {
  842. font-family: 'Source Han Sans SC';
  843. font-weight: 500;
  844. font-size: 22rpx;
  845. color: #D81A00;
  846. }
  847. .price-val {
  848. font-family: 'Source Han Sans SC';
  849. font-weight: 500;
  850. font-size: 28rpx;
  851. color: #D81A00;
  852. margin-right: 12rpx;
  853. }
  854. .price-old {
  855. font-family: 'Source Han Sans SC';
  856. font-weight: 500;
  857. font-size: 22rpx;
  858. color: #999999;
  859. text-decoration: line-through;
  860. }
  861. }
  862. .add-btn {
  863. width: fit-content;
  864. height: 36rpx;
  865. line-height: 36rpx;
  866. background: linear-gradient(0deg, #4ED964 0%, #4ED964 100%);
  867. border-radius: 18rpx;
  868. padding: 0 20rpx;
  869. display: flex;
  870. align-items: center;
  871. justify-content: center;
  872. text {
  873. font-size: 22rpx;
  874. color: #fff;
  875. }
  876. .cart-symbol {
  877. width: 24rpx;
  878. height: 24rpx;
  879. margin-left: 6rpx;
  880. }
  881. }
  882. }
  883. }
  884. .bottom-safe-area {
  885. height: 30rpx
  886. }
  887. .red-packet-btn {
  888. width: 126rpx;
  889. height: 140rpx;
  890. background: transparent;
  891. border: none;
  892. padding: 0;
  893. margin: 0;
  894. display: flex;
  895. align-items: center;
  896. justify-content: center;
  897. &::after {
  898. border: none;
  899. }
  900. }
  901. /* 客服悬浮按钮 */
  902. .service-btn {
  903. width: 126rpx;
  904. height: 140rpx;
  905. background: transparent;
  906. border: none;
  907. padding: 0;
  908. margin: 0;
  909. display: flex;
  910. align-items: center;
  911. justify-content: center;
  912. &::after {
  913. border: none;
  914. }
  915. .cs-icon {
  916. width: 126rpx;
  917. height: 140rpx;
  918. }
  919. }
  920. </style>