activityProductDetail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. <template>
  2. <view class="detail-container">
  3. <!-- 轮播图区域 -->
  4. <swiper class="swiper-box" :indicator-dots="true" :circular="true" :autoplay="true" :interval="3000" :duration="500">
  5. <swiper-item v-for="(img, index) in sliderImages" :key="index">
  6. <image :src="img" class="slide-image" mode="aspectFill"></image>
  7. </swiper-item>
  8. </swiper>
  9. <!-- 价格与倒计时区域 -->
  10. <view class="price-section" :class="activityType">
  11. <view class="price-info">
  12. <view class="activity-price">
  13. <text class="unit">¥</text>
  14. <text class="num">{{ currentPrice }}</text>
  15. </view>
  16. <view class="original-price">
  17. <text>¥{{ detailData.originalPrice || detailData.otPrice }}</text>
  18. </view>
  19. </view>
  20. <view class="countdown-info" v-if="detailData.activityStatus !== 'ended' && detailData.activityStatus !== 'sold_out'">
  21. <text class="countdown-title">{{ detailData.activityStatus === 'not_started' ? '距开始' : '距结束' }}</text>
  22. <view class="countdown-time">
  23. <text class="time-block">{{ formatTime(detailData.countdown).h }}</text>
  24. <text class="colon">:</text>
  25. <text class="time-block">{{ formatTime(detailData.countdown).m }}</text>
  26. <text class="colon">:</text>
  27. <text class="time-block">{{ formatTime(detailData.countdown).s }}</text>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 商品基础信息 -->
  32. <view class="base-info">
  33. <view class="title">
  34. <text class="group-tag" v-if="activityType === 'group' && detailData.groupNum">{{ detailData.groupNum }}人团</text>
  35. {{ detailData.productName }}
  36. </view>
  37. <view class="sub-info">
  38. <text class="sales">销量: {{ detailData.sales || 0 }}</text>
  39. <text class="stock">剩余库存: {{ detailData.productStock || 0 }}</text>
  40. </view>
  41. </view>
  42. <!-- 商品详情 -->
  43. <view class="product-detail">
  44. <view class="detail-title">商品详情</view>
  45. <view class="detail-content">
  46. <rich-text :nodes="detailData.productInfo || '暂无详情'"></rich-text>
  47. </view>
  48. </view>
  49. <!-- 底部操作栏 -->
  50. <view class="bottom-action">
  51. <view class="btn-group">
  52. <button
  53. class="action-btn"
  54. :class="[
  55. activityType,
  56. detailData.activityStatus === 'not_started' ? 'disabled' : '',
  57. detailData.activityStatus === 'sold_out' ? 'disabled' : '',
  58. detailData.activityStatus === 'ended' ? 'disabled' : ''
  59. ]"
  60. @tap="handleBuy"
  61. >
  62. {{ btnText }}
  63. </button>
  64. </view>
  65. </view>
  66. <!-- 规格选择弹窗 -->
  67. <popupBottom ref="popup" :visible.sync="specVisible" title=" " radius="32" maxHeight="1024">
  68. <view class="product-spec" v-if="detailData">
  69. <!-- 商品信息 -->
  70. <view class="pro-info">
  71. <view class="img-box">
  72. <image :src="currentSpec.image || detailData.productImage" mode="aspectFill"></image>
  73. </view>
  74. <view class="info-text">
  75. <view class="price">
  76. <text class="unit">¥</text>
  77. <text class="num">{{ currentSpec.price || currentPrice }}</text>
  78. </view>
  79. <view class="desc-box">
  80. <text class="text">已选:{{ currentSpec.specName || '默认规格' }}</text>
  81. <text class="text">库存:{{ currentSpec.stock !== undefined ? currentSpec.stock : detailData.productStock }}</text>
  82. </view>
  83. </view>
  84. </view>
  85. <!-- 规格列表 -->
  86. <view class="spec-box" v-if="detailData.specs && detailData.specs.length > 0">
  87. <view class="title">规格</view>
  88. <view class="spec-list">
  89. <view
  90. v-for="(item, index) in detailData.specs"
  91. :key="index"
  92. :class="['item', specIndex === index ? 'active' : '']"
  93. @click="choseSpec(index)">
  94. {{ item.specName || '默认规格' }}
  95. </view>
  96. </view>
  97. </view>
  98. <!-- 数量 (秒杀折扣限制数量为1,不可修改) -->
  99. <!-- <view class="price-num">
  100. <view class="label">数量</view>
  101. <view class="num-box">
  102. <view class="img-box" style="background:#f5f5f5;">
  103. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/purpleShop/jian.png" mode=""></image>
  104. </view>
  105. <input type="number" value="1" disabled style="background:#f5f5f5;" />
  106. <view class="img-box" style="background:#f5f5f5;">
  107. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/purpleShop/add.png" mode=""></image>
  108. </view>
  109. </view>
  110. </view> -->
  111. <view class="sub-btn" @click="submitSpec">确定</view>
  112. </view>
  113. </popupBottom>
  114. </view>
  115. </template>
  116. <script>
  117. import { getFlashSaleDetail, getFlashSaleServerTime } from '@/api/flashSale.js';
  118. import { getDiscountDetail, getDiscountServerTime } from '@/api/discount.js';
  119. import { getGroupBuyDetail, getGroupBuyServerTime } from '@/api/groupBuy.js';
  120. import { addCart } from '@/api/product.js';
  121. import popupBottom from '@/components/px-popup-bottom/px-popup-bottom.vue';
  122. export default {
  123. components: {
  124. popupBottom
  125. },
  126. data() {
  127. return {
  128. activityType: 'flash', // 'flash', 'discount' 或 'group'
  129. activityId: '',
  130. detailData: {},
  131. timer: null,
  132. stockTimer: null,
  133. serverTimestamp: 0,
  134. specVisible: false,
  135. specIndex: 0
  136. };
  137. },
  138. computed: {
  139. currentPrice() {
  140. if (this.activityType === 'flash') {
  141. return this.detailData.flashPrice || 0;
  142. } else if (this.activityType === 'discount') {
  143. return this.detailData.discountPrice || this.detailData.groupPrice || 0;
  144. } else {
  145. return this.detailData.groupPrice || 0;
  146. }
  147. },
  148. btnText() {
  149. const status = this.detailData.activityStatus;
  150. switch (status) {
  151. case 'not_started':
  152. let time = this.formatTime(this.detailData.countdown);
  153. return `即将开始 ${time.h}:${time.m}:${time.s}`;
  154. case 'ongoing': return this.activityType === 'group' ? '立即参团' : '立即抢购';
  155. case 'sold_out': return '已售罄';
  156. case 'ended': return '已结束';
  157. default: return '抢购';
  158. }
  159. },
  160. sliderImages() {
  161. // 解析接口中的 sliderImage
  162. if (this.detailData.sliderImage) {
  163. if (typeof this.detailData.sliderImage === 'string') {
  164. return this.detailData.sliderImage.split(',').filter(item => item.trim() !== '');
  165. } else if (Array.isArray(this.detailData.sliderImage)) {
  166. return this.detailData.sliderImage;
  167. }
  168. }
  169. // 如果没有 sliderImage,兜底使用 productImage
  170. return this.detailData.productImage ? [this.detailData.productImage] : [];
  171. },
  172. currentSpec() {
  173. if (this.detailData.specs && this.detailData.specs.length > 0) {
  174. let spec = this.detailData.specs[this.specIndex];
  175. if (spec) {
  176. if (this.activityType === 'flash') {
  177. spec.price = spec.flashPrice;
  178. } else if (this.activityType === 'discount') {
  179. spec.price = spec.discountPrice || spec.groupPrice;
  180. } else {
  181. spec.price = spec.groupPrice;
  182. }
  183. return spec;
  184. }
  185. }
  186. return {};
  187. }
  188. },
  189. onLoad(options) {
  190. if (options.type) {
  191. this.activityType = options.type;
  192. let title = '商品详情';
  193. if (this.activityType === 'flash') title = '秒杀商品详情';
  194. else if (this.activityType === 'discount') title = '折扣商品详情';
  195. else if (this.activityType === 'group') title = '团购商品详情';
  196. uni.setNavigationBarTitle({ title });
  197. }
  198. if (options.id) {
  199. this.activityId = options.id;
  200. this.fetchDetailData();
  201. }
  202. },
  203. onUnload() {
  204. this.clearTimer();
  205. this.clearStockPolling();
  206. },
  207. onHide() {
  208. this.clearTimer();
  209. this.clearStockPolling();
  210. },
  211. onShow() {
  212. // 如果页面重新显示且数据已存在,则重新启动定时器(可选,取决于具体业务需不需要继续跑倒计时)
  213. if (this.detailData && this.detailData.id) {
  214. if (!this.timer) this.startTimer();
  215. if (!this.stockTimer && this.detailData.activityStatus !== 'sold_out' && this.detailData.activityStatus !== 'ended') {
  216. this.startStockPolling();
  217. }
  218. }
  219. },
  220. beforeDestroy() {
  221. this.clearTimer();
  222. this.clearStockPolling();
  223. },
  224. methods: {
  225. async fetchDetailData() {
  226. try {
  227. let detailRes, timeRes;
  228. if (this.activityType === 'flash') {
  229. [detailRes, timeRes] = await Promise.all([
  230. getFlashSaleDetail(this.activityId),
  231. getFlashSaleServerTime()
  232. ]);
  233. } else if (this.activityType === 'discount') {
  234. [detailRes, timeRes] = await Promise.all([
  235. getDiscountDetail(this.activityId),
  236. getDiscountServerTime()
  237. ]);
  238. } else {
  239. [detailRes, timeRes] = await Promise.all([
  240. getGroupBuyDetail(this.activityId),
  241. getGroupBuyServerTime()
  242. ]);
  243. }
  244. if (detailRes.code === 0 || detailRes.code === 200) {
  245. this.detailData = detailRes.data || {};
  246. let currentServerTime = Date.now();
  247. if (timeRes.code === 0 || timeRes.code === 200) {
  248. currentServerTime = timeRes.serverTimestamp || timeRes.data?.serverTimestamp || Date.now();
  249. } else if (detailRes.serverTimestamp) {
  250. currentServerTime = detailRes.serverTimestamp;
  251. }
  252. const serverTimeSec = Math.floor(currentServerTime / 1000);
  253. // 重新校准倒计时
  254. let targetTime = 0;
  255. if (this.detailData.activityStatus === 'not_started') {
  256. targetTime = Math.floor(new Date(this.detailData.startTime.replace(/-/g, '/')).getTime() / 1000);
  257. } else if (this.detailData.activityStatus === 'ongoing') {
  258. targetTime = Math.floor(new Date(this.detailData.endTime.replace(/-/g, '/')).getTime() / 1000);
  259. }
  260. if (targetTime > 0) {
  261. let diff = targetTime - serverTimeSec;
  262. this.detailData.countdown = diff > 0 ? diff : 0;
  263. }
  264. this.startTimer();
  265. this.startStockPolling();
  266. } else {
  267. uni.showToast({
  268. title: detailRes.msg || '获取详情失败',
  269. icon: 'none'
  270. });
  271. }
  272. } catch (error) {
  273. console.error('获取详情数据失败', error);
  274. }
  275. },
  276. startTimer() {
  277. this.clearTimer();
  278. this.timer = setInterval(() => {
  279. if (this.detailData.countdown > 0) {
  280. this.detailData.countdown--;
  281. } else if (this.detailData.countdown === 0 && this.detailData.activityStatus === 'not_started') {
  282. this.detailData.activityStatus = 'ongoing';
  283. let endTimeSec = Math.floor(new Date(this.detailData.endTime.replace(/-/g, '/')).getTime() / 1000);
  284. let nowSec = Math.floor(Date.now() / 1000);
  285. let diff = endTimeSec - nowSec;
  286. this.detailData.countdown = diff > 0 ? diff : 0;
  287. } else if (this.detailData.countdown === 0 && this.detailData.activityStatus === 'ongoing') {
  288. this.detailData.activityStatus = 'ended';
  289. this.clearTimer();
  290. }
  291. }, 1000);
  292. },
  293. clearTimer() {
  294. if (this.timer) {
  295. clearInterval(this.timer);
  296. this.timer = null;
  297. }
  298. },
  299. startStockPolling() {
  300. this.clearStockPolling();
  301. this.stockTimer = setInterval(async () => {
  302. try {
  303. let res;
  304. if (this.activityType === 'flash') {
  305. res = await getFlashSaleDetail(this.activityId);
  306. } else if (this.activityType === 'discount') {
  307. res = await getDiscountDetail(this.activityId);
  308. } else {
  309. res = await getGroupBuyDetail(this.activityId);
  310. }
  311. if (res.code === 0 || res.code === 200) {
  312. let productStock = res.data?.productStock || 0;
  313. this.detailData.productStock = productStock;
  314. if (productStock <= 0) {
  315. this.detailData.activityStatus = 'sold_out';
  316. this.clearStockPolling();
  317. }
  318. }
  319. } catch (e) {
  320. console.error('获取实时库存失败', e);
  321. }
  322. }, 3000);
  323. },
  324. clearStockPolling() {
  325. if (this.stockTimer) {
  326. clearInterval(this.stockTimer);
  327. this.stockTimer = null;
  328. }
  329. },
  330. formatTime(seconds) {
  331. if (!seconds || seconds <= 0) return { h: '00', m: '00', s: '00' };
  332. let h = Math.floor(seconds / 3600);
  333. let m = Math.floor((seconds % 3600) / 60);
  334. let s = seconds % 60;
  335. return {
  336. h: h.toString().padStart(2, '0'),
  337. m: m.toString().padStart(2, '0'),
  338. s: s.toString().padStart(2, '0')
  339. };
  340. },
  341. handleBuy() {
  342. const status = this.detailData.activityStatus;
  343. if (status === 'not_started') {
  344. uni.showToast({ title: '活动尚未开始,请耐心等待', icon: 'none' });
  345. return;
  346. }
  347. if (status === 'ended') {
  348. uni.showToast({ title: '抱歉,活动已结束', icon: 'none' });
  349. return;
  350. }
  351. if (status === 'sold_out' || this.detailData.productStock <= 0) {
  352. uni.showToast({ title: '活动商品已售罄', icon: 'none' });
  353. return;
  354. }
  355. if (this.detailData.status === 0) {
  356. uni.showToast({ title: '商品已下架', icon: 'none' });
  357. return;
  358. }
  359. // 打开规格选择弹窗
  360. this.specVisible = true;
  361. },
  362. choseSpec(index) {
  363. this.specIndex = index;
  364. },
  365. submitSpec() {
  366. let stock = this.currentSpec.stock !== undefined ? this.currentSpec.stock : this.detailData.productStock;
  367. if (stock <= 0) {
  368. uni.showToast({ title: '该规格库存不足', icon: 'none' });
  369. return;
  370. }
  371. // 调用加入购物车接口(立即购买模式 isBuy: 1)
  372. let attrValueId = 0;
  373. if (this.detailData.specs && this.detailData.specs.length > 0) {
  374. attrValueId = this.detailData.specs[this.specIndex].specId || this.detailData.specs[this.specIndex].id || 0;
  375. }
  376. let data = {
  377. isBuy: 1,
  378. cartNum: 1, // 秒杀/折扣强制为1件
  379. productId: this.detailData.productId,
  380. attrValueId: attrValueId
  381. };
  382. uni.showLoading({ title: '加载中' });
  383. addCart(data).then(res => {
  384. uni.hideLoading();
  385. if (res.code === 200) {
  386. this.specVisible = false; // 关闭弹窗
  387. let cartIds = res.id;
  388. let orderType = 6;
  389. if (this.activityType === 'flash') orderType = 6;
  390. else if (this.activityType === 'discount') orderType = 7;
  391. else if (this.activityType === 'group') orderType = 8;
  392. // associatedId 为中间表 ID,即 specs 数组里的 id
  393. let associatedId = this.detailData.specs && this.detailData.specs.length > 0 ? (this.detailData.specs[this.specIndex].id || this.activityId) : this.activityId;
  394. uni.navigateTo({
  395. url: `/pages/shopping/confirmOrder?type=buy&cartIds=${cartIds}&orderType=${orderType}&activityType=${this.activityType}&productId=${this.detailData.productId}&associatedId=${associatedId}`
  396. });
  397. } else {
  398. uni.showToast({
  399. icon: 'none',
  400. title: res.msg || '操作失败'
  401. });
  402. }
  403. }).catch(err => {
  404. uni.hideLoading();
  405. console.error(err);
  406. });
  407. }
  408. }
  409. };
  410. </script>
  411. <style lang="scss" scoped>
  412. .detail-container {
  413. min-height: 100vh;
  414. background-color: #f5f5f5;
  415. padding-bottom: 120rpx;
  416. }
  417. .swiper-box {
  418. width: 100%;
  419. height: 750rpx;
  420. .slide-image {
  421. width: 100%;
  422. height: 100%;
  423. background-color: #fff;
  424. }
  425. }
  426. .price-section {
  427. display: flex;
  428. justify-content: space-between;
  429. align-items: center;
  430. padding: 20rpx 30rpx;
  431. color: #fff;
  432. &.flash {
  433. background: linear-gradient(90deg, #ff6000, #ff4a00);
  434. }
  435. &.discount {
  436. background: linear-gradient(90deg, #b835c9, #9c26b0);
  437. }
  438. &.group {
  439. background: linear-gradient(90deg, #66b2ef, #4C49E9);
  440. }
  441. .price-info {
  442. display: flex;
  443. align-items: baseline;
  444. .activity-price {
  445. font-size: 48rpx;
  446. font-weight: bold;
  447. margin-right: 20rpx;
  448. .unit {
  449. font-size: 32rpx;
  450. }
  451. }
  452. .original-price {
  453. font-size: 26rpx;
  454. text-decoration: line-through;
  455. opacity: 0.8;
  456. }
  457. }
  458. .countdown-info {
  459. display: flex;
  460. flex-direction: column;
  461. align-items: flex-end;
  462. .countdown-title {
  463. font-size: 24rpx;
  464. margin-bottom: 8rpx;
  465. }
  466. .countdown-time {
  467. display: flex;
  468. align-items: center;
  469. .time-block {
  470. background-color: rgba(255, 255, 255, 0.2);
  471. color: #fff;
  472. font-size: 24rpx;
  473. padding: 4rpx 8rpx;
  474. border-radius: 6rpx;
  475. }
  476. .colon {
  477. margin: 0 6rpx;
  478. font-weight: bold;
  479. }
  480. }
  481. }
  482. }
  483. .base-info {
  484. background-color: #fff;
  485. padding: 30rpx;
  486. margin-bottom: 20rpx;
  487. .title {
  488. font-size: 32rpx;
  489. color: #333;
  490. font-weight: bold;
  491. line-height: 44rpx;
  492. margin-bottom: 20rpx;
  493. .group-tag {
  494. display: inline-block;
  495. padding: 0 12rpx;
  496. height: 34rpx;
  497. line-height: 34rpx;
  498. background: #4C49E9;
  499. color: #fff;
  500. font-size: 20rpx;
  501. border-radius: 4rpx;
  502. margin-right: 12rpx;
  503. vertical-align: middle;
  504. font-weight: normal;
  505. }
  506. }
  507. .sub-info {
  508. display: flex;
  509. justify-content: space-between;
  510. font-size: 24rpx;
  511. color: #999;
  512. }
  513. }
  514. .product-detail {
  515. background-color: #fff;
  516. padding: 30rpx;
  517. .detail-title {
  518. font-size: 30rpx;
  519. font-weight: bold;
  520. color: #333;
  521. margin-bottom: 20rpx;
  522. border-left: 6rpx solid #ff4a00;
  523. padding-left: 16rpx;
  524. }
  525. .detail-content {
  526. font-size: 28rpx;
  527. color: #666;
  528. line-height: 1.6;
  529. img {
  530. max-width: 100%;
  531. }
  532. }
  533. }
  534. .bottom-action {
  535. position: fixed;
  536. bottom: 0;
  537. left: 0;
  538. right: 0;
  539. height: 100rpx;
  540. background-color: #fff;
  541. display: flex;
  542. align-items: center;
  543. padding: 0 30rpx;
  544. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  545. z-index: 99;
  546. .btn-group {
  547. flex: 1;
  548. .action-btn {
  549. width: 100%;
  550. height: 80rpx;
  551. line-height: 80rpx;
  552. border-radius: 40rpx;
  553. font-size: 30rpx;
  554. color: #fff;
  555. border: none;
  556. &::after {
  557. display: none;
  558. }
  559. &.flash {
  560. background: linear-gradient(90deg, #ff6000, #ff4a00);
  561. }
  562. &.discount {
  563. background: linear-gradient(90deg, #b835c9, #9c26b0);
  564. }
  565. &.group {
  566. background: linear-gradient(90deg, #66b2ef, #4C49E9);
  567. }
  568. &.disabled {
  569. background: #cccccc;
  570. }
  571. }
  572. }
  573. }
  574. .product-spec {
  575. padding: 30rpx;
  576. background: #fff;
  577. border-radius: 32rpx 32rpx 0 0;
  578. .pro-info {
  579. display: flex;
  580. align-items: center;
  581. padding-bottom: 30rpx;
  582. border-bottom: 1rpx solid #f5f5f5;
  583. .img-box {
  584. width: 160rpx;
  585. height: 160rpx;
  586. background: #f8f8f8;
  587. border-radius: 12rpx;
  588. margin-right: 20rpx;
  589. overflow: hidden;
  590. image {
  591. width: 100%;
  592. height: 100%;
  593. }
  594. }
  595. .info-text {
  596. display: flex;
  597. flex-direction: column;
  598. justify-content: space-around;
  599. height: 140rpx;
  600. .price {
  601. display: flex;
  602. align-items: baseline;
  603. color: #ff4a00;
  604. .unit {
  605. font-size: 24rpx;
  606. }
  607. .num {
  608. font-size: 40rpx;
  609. font-weight: bold;
  610. }
  611. }
  612. .desc-box {
  613. display: flex;
  614. flex-direction: column;
  615. .text {
  616. font-size: 24rpx;
  617. color: #999;
  618. margin-top: 8rpx;
  619. }
  620. }
  621. }
  622. }
  623. .spec-box {
  624. padding: 30rpx 0;
  625. border-bottom: 1rpx solid #f5f5f5;
  626. .title {
  627. font-size: 28rpx;
  628. color: #333;
  629. font-weight: bold;
  630. margin-bottom: 20rpx;
  631. }
  632. .spec-list {
  633. display: flex;
  634. flex-wrap: wrap;
  635. .item {
  636. padding: 10rpx 30rpx;
  637. background: #f5f5f5;
  638. color: #333;
  639. font-size: 26rpx;
  640. border-radius: 30rpx;
  641. margin-right: 20rpx;
  642. margin-bottom: 20rpx;
  643. border: 1rpx solid transparent;
  644. &.active {
  645. background: rgba(255, 74, 0, 0.1);
  646. color: #ff4a00;
  647. border-color: #ff4a00;
  648. }
  649. }
  650. }
  651. }
  652. .price-num {
  653. display: flex;
  654. justify-content: space-between;
  655. align-items: center;
  656. padding: 30rpx 0 50rpx 0;
  657. .label {
  658. font-size: 28rpx;
  659. color: #333;
  660. font-weight: bold;
  661. }
  662. .num-box {
  663. display: flex;
  664. align-items: center;
  665. .img-box {
  666. width: 50rpx;
  667. height: 50rpx;
  668. display: flex;
  669. justify-content: center;
  670. align-items: center;
  671. background: #f5f5f5;
  672. border-radius: 6rpx;
  673. image {
  674. width: 24rpx;
  675. height: 24rpx;
  676. }
  677. }
  678. input {
  679. width: 80rpx;
  680. text-align: center;
  681. font-size: 28rpx;
  682. color: #333;
  683. }
  684. }
  685. }
  686. .sub-btn {
  687. width: 100%;
  688. height: 80rpx;
  689. line-height: 80rpx;
  690. text-align: center;
  691. background: linear-gradient(90deg, #ff6000, #ff4a00);
  692. color: #fff;
  693. border-radius: 40rpx;
  694. font-size: 30rpx;
  695. margin-bottom: 20rpx;
  696. }
  697. }
  698. </style>