showpro.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867
  1. <template>
  2. <view class="container">
  3. <view class="carousel">
  4. <swiper indicator-dots :circular="true" duration="400">
  5. <swiper-item class="swiper-item" v-for="(item, index) in good.slider_image" :key="index">
  6. <view class="image-wrapper">
  7. <image :src="item" class="loaded" mode="scaleToFill"></image>
  8. </view>
  9. </swiper-item>
  10. </swiper>
  11. </view>
  12. <view class="introduce-section">
  13. <view class="price-box">
  14. <text class="price-tip">¥</text>
  15. <text class="price">{{ good.hanging_price }}</text>
  16. </view>
  17. <text class="title">{{ good.name }}</text>
  18. </view>
  19. <view class="detail-desc">
  20. <view class="d-header"><text>商品详情</text></view>
  21. <rich-text class="detail-centent" :nodes="good.description"></rich-text>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. // import share from '@/components/share';
  28. import uniNumberBox from '@/components/uni-number-box.vue';
  29. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  30. import { product } from '@/api/index.js'
  31. import {
  32. goodsDetail,
  33. cartAdd,
  34. collectAdd,
  35. collectDel,
  36. seckillGoods,
  37. groupGoods
  38. } from '@/api/product.js';
  39. // #ifdef H5
  40. import {
  41. weixindata,
  42. shareLoad
  43. } from '@/utils/wxAuthorized';
  44. import {
  45. mapState
  46. } from 'vuex';
  47. import weixinObj from "@/plugin/jweixin-module/index.js";
  48. // #endif
  49. export default {
  50. components: {
  51. uniNumberBox,
  52. uniCountdown
  53. },
  54. filters: {
  55. address(val) {
  56. let str = '';
  57. if (val) {
  58. str = val[0] + ' ' + val[1];
  59. }
  60. return str;
  61. }
  62. },
  63. data() {
  64. return {
  65. goodId: '',
  66. good: {}
  67. };
  68. },
  69. async onLoad(opt) {
  70. let obj = this;
  71. obj.goodId = opt.id
  72. this.getproduct()
  73. },
  74. computed: {
  75. // #ifdef H5
  76. ...mapState(['weichatObj', 'baseURL', 'urlFile']),
  77. ...mapState('user', ['userInfo'])
  78. // #endif
  79. },
  80. methods: {
  81. getproduct() {
  82. let obj =this
  83. product({
  84. id: obj.goodId
  85. }).then(res => {
  86. console.log(res)
  87. obj.good = res.data
  88. })
  89. },
  90. }
  91. };
  92. </script>
  93. <style lang="scss">
  94. page {
  95. background: $page-color-base;
  96. }
  97. //秒杀底部高度
  98. .seckillBottom {
  99. height: 110rpx;
  100. }
  101. // 文章页底部高度撑开
  102. .contentBottomHeight {
  103. height: 110rpx;
  104. }
  105. //默认商品底部高度
  106. .goodsBottom {
  107. height: 160rpx;
  108. }
  109. .iconenter {
  110. font-size: $font-base + 2rpx;
  111. color: #888;
  112. }
  113. .carousel {
  114. /* #ifdef APP-PLUS */
  115. // padding-top: var(--status-bar-height);
  116. /* #endif */
  117. height: 722rpx;
  118. position: relative;
  119. swiper {
  120. height: 100%;
  121. }
  122. .image-wrapper {
  123. width: 100%;
  124. height: 100%;
  125. }
  126. .swiper-item {
  127. display: flex;
  128. justify-content: center;
  129. align-content: center;
  130. // height: 750rpx;
  131. height: 710rpx;
  132. overflow: hidden;
  133. image {
  134. width: 100%;
  135. height: 100%;
  136. }
  137. }
  138. }
  139. // 秒杀
  140. .seckill-box-title {
  141. background: linear-gradient(90deg, rgba(239, 78, 81, 1) 0%, rgba(244, 113, 59, 1) 100%) !important;
  142. .price,
  143. .price-tip,
  144. .timeStop,
  145. .m-price {
  146. color: #ffffff !important;
  147. }
  148. .price-tip {
  149. font-size: $font-base;
  150. }
  151. .price {
  152. font-size: 45rpx !important;
  153. font-weight: bold;
  154. }
  155. .timeStop {}
  156. }
  157. // 底部拼团、秒杀支付按钮
  158. .goods-pay-box {
  159. position: fixed;
  160. left: 0;
  161. bottom: 0;
  162. z-index: 95;
  163. width: 750rpx;
  164. height: 100rpx;
  165. line-height: 1;
  166. color: #ffffff;
  167. text-align: center;
  168. font-size: $font-lg;
  169. .bgLine {
  170. background: linear-gradient(90deg, rgba(239, 78, 81, 1) 0%, rgba(244, 113, 59, 1) 100%);
  171. }
  172. // 拼团支付按钮
  173. .goods-pay {
  174. display: flex;
  175. align-content: center;
  176. flex-wrap: wrap;
  177. justify-content: center;
  178. .goods-buttom,
  179. .goods-buttom-money {
  180. width: 100%;
  181. }
  182. .goods-buttom-money {
  183. font-size: $font-base;
  184. }
  185. }
  186. .goods-pay-stop,
  187. .goods-pay {
  188. padding: 15rpx 0;
  189. height: 100%;
  190. width: 100%;
  191. }
  192. .goods-pay-stop {
  193. background: $color-gray;
  194. line-height: 70rpx;
  195. }
  196. }
  197. /* 标题简介 */
  198. .introduce-section {
  199. background: #fff;
  200. padding: 20rpx 30rpx;
  201. .title {
  202. font-size: 32rpx;
  203. color: $font-color-dark;
  204. height: 50rpx;
  205. line-height: 50rpx;
  206. }
  207. .price-box {
  208. display: flex;
  209. align-items: baseline;
  210. height: 64rpx;
  211. padding: 10rpx 0;
  212. font-size: 26rpx;
  213. color: #FD3B39;
  214. }
  215. .price {
  216. font-size: $font-lg + 2rpx;
  217. }
  218. .m-price {
  219. margin: 0 12rpx;
  220. color: $font-color-light;
  221. text-decoration: line-through;
  222. }
  223. .coupon-tip {
  224. align-items: center;
  225. padding: 4rpx 10rpx;
  226. background: $uni-color-primary;
  227. font-size: $font-sm;
  228. color: #fff;
  229. border-radius: 6rpx;
  230. line-height: 1;
  231. transform: translateY(-4rpx);
  232. }
  233. .bot-row {
  234. display: flex;
  235. align-items: center;
  236. height: 50rpx;
  237. font-size: $font-sm;
  238. color: $font-color-light;
  239. text {
  240. flex: 1;
  241. }
  242. }
  243. }
  244. /* 分享 */
  245. .share-section {
  246. display: flex;
  247. align-items: center;
  248. color: $font-color-base;
  249. background: linear-gradient(left, #fdf5f6, #fbebf6);
  250. padding: 12rpx 30rpx;
  251. .share-icon {
  252. display: flex;
  253. align-items: center;
  254. width: 70rpx;
  255. height: 30rpx;
  256. line-height: 1;
  257. border: 1px solid $uni-color-primary;
  258. border-radius: 4rpx;
  259. position: relative;
  260. overflow: hidden;
  261. font-size: 22rpx;
  262. color: $uni-color-primary;
  263. &:after {
  264. content: '';
  265. width: 50rpx;
  266. height: 50rpx;
  267. border-radius: 50%;
  268. left: -20rpx;
  269. top: -12rpx;
  270. position: absolute;
  271. background: $uni-color-primary;
  272. }
  273. }
  274. .iconfavorfill {
  275. position: relative;
  276. z-index: 1;
  277. font-size: 24rpx;
  278. margin-left: 2rpx;
  279. margin-right: 10rpx;
  280. color: #fff;
  281. line-height: 1;
  282. }
  283. .tit {
  284. font-size: $font-base;
  285. margin-left: 10rpx;
  286. }
  287. .iconprompt {
  288. padding: 10rpx;
  289. font-size: 30rpx;
  290. line-height: 1;
  291. }
  292. .share-btn {
  293. flex: 1;
  294. text-align: right;
  295. font-size: $font-sm;
  296. color: $uni-color-primary;
  297. }
  298. .iconenter {
  299. font-size: $font-sm;
  300. margin-left: 4rpx;
  301. color: $uni-color-primary;
  302. }
  303. }
  304. .c-list {
  305. margin-top: 20rpx;
  306. font-size: $font-sm + 2rpx;
  307. color: $font-color-base;
  308. background: #fff;
  309. .c-row {
  310. display: flex;
  311. align-items: center;
  312. padding: 20rpx 30rpx;
  313. position: relative;
  314. }
  315. .tit {
  316. width: 140rpx;
  317. }
  318. .con {
  319. flex: 1;
  320. color: $font-color-dark;
  321. .selected-text {
  322. margin-right: 10rpx;
  323. .num {
  324. color: #FD3B39;
  325. }
  326. }
  327. }
  328. .bz-list {
  329. height: 40rpx;
  330. font-size: $font-sm + 2rpx;
  331. color: $font-color-dark;
  332. text {
  333. display: inline-block;
  334. margin-right: 30rpx;
  335. }
  336. }
  337. .con-list {
  338. flex: 1;
  339. display: flex;
  340. flex-direction: column;
  341. color: $font-color-dark;
  342. line-height: 40rpx;
  343. }
  344. .red {
  345. color: $uni-color-primary;
  346. }
  347. }
  348. /* 评价 */
  349. .eva-section {
  350. display: flex;
  351. flex-direction: column;
  352. padding: 20rpx 30rpx;
  353. background: #fff;
  354. margin-top: 16rpx;
  355. .e-header {
  356. display: flex;
  357. align-items: center;
  358. height: 70rpx;
  359. font-size: $font-sm + 2rpx;
  360. color: $font-color-light;
  361. .tit {
  362. font-size: $font-base + 2rpx;
  363. color: $font-color-dark;
  364. margin-right: 4rpx;
  365. }
  366. .tip {
  367. flex: 1;
  368. text-align: right;
  369. }
  370. .iconenter {
  371. margin-left: 10rpx;
  372. }
  373. }
  374. }
  375. .eva-box {
  376. display: flex;
  377. padding: 20rpx 0;
  378. .portrait {
  379. flex-shrink: 0;
  380. width: 80rpx;
  381. height: 80rpx;
  382. border-radius: 100px;
  383. }
  384. .right {
  385. flex: 1;
  386. display: flex;
  387. flex-direction: column;
  388. font-size: $font-base;
  389. color: $font-color-base;
  390. padding-left: 26rpx;
  391. .con {
  392. font-size: $font-base;
  393. color: $font-color-dark;
  394. padding: 20rpx 0;
  395. }
  396. .bot {
  397. display: flex;
  398. justify-content: space-between;
  399. font-size: $font-sm;
  400. color: $font-color-light;
  401. }
  402. }
  403. }
  404. .eva-boxs {
  405. width: 100%;
  406. overflow: hidden;
  407. padding: 10px 28rpx;
  408. background: #f4f4f4;
  409. border-radius: 12rpx;
  410. font-size: $font-sm + 2rpx;
  411. color: #333;
  412. .portrait {
  413. flex-shrink: 0;
  414. width: 80rpx;
  415. height: 80rpx;
  416. border-radius: 100px;
  417. }
  418. .right {
  419. flex: 1;
  420. display: flex;
  421. flex-direction: column;
  422. font-size: $font-base;
  423. color: $font-color-base;
  424. .con {
  425. font-size: $font-base;
  426. color: $font-color-dark;
  427. }
  428. .bot {
  429. display: flex;
  430. justify-content: space-between;
  431. font-size: $font-sm;
  432. color: $font-color-light;
  433. }
  434. }
  435. }
  436. /* 详情 */
  437. .detail-desc {
  438. background: #fff;
  439. margin-top: 16rpx;
  440. /deep/ img {
  441. max-width: 100% !important;
  442. display: inline !important;
  443. }
  444. /deep/ div {
  445. max-width: 100% !important;
  446. }
  447. .d-header {
  448. display: flex;
  449. justify-content: center;
  450. align-items: center;
  451. height: 80rpx;
  452. font-size: $font-base + 2rpx;
  453. color: $font-color-dark;
  454. position: relative;
  455. text {
  456. padding: 0 20rpx;
  457. background: #fff;
  458. position: relative;
  459. z-index: 1;
  460. }
  461. &:after {
  462. position: absolute;
  463. left: 50%;
  464. top: 50%;
  465. transform: translateX(-50%);
  466. width: 300rpx;
  467. height: 0;
  468. content: '';
  469. border-bottom: 1px solid #ccc;
  470. }
  471. }
  472. }
  473. /* 规格选择弹窗 */
  474. .attr-content {
  475. padding: 10rpx 0 0;
  476. .a-t {
  477. padding: 0 30rpx;
  478. display: flex;
  479. image {
  480. width: 170rpx;
  481. height: 170rpx;
  482. flex-shrink: 0;
  483. border-radius: 8rpx;
  484. }
  485. .right {
  486. display: flex;
  487. flex-direction: column;
  488. padding-left: 24rpx;
  489. font-size: $font-sm + 2rpx;
  490. color: $font-color-base;
  491. line-height: 42rpx;
  492. .good-name {
  493. padding-top: 20rpx;
  494. max-width: 320rpx;
  495. font-size: 30rpx;
  496. font-family: PingFang SC;
  497. font-weight: bold;
  498. color: #1d2023;
  499. line-height: 42rpx;
  500. margin-bottom: 15rpx;
  501. }
  502. .price {
  503. font-size: 60rpx;
  504. font-family: PingFang SC;
  505. font-weight: bold;
  506. color: #ff6f0f;
  507. // font-size: $font-lg;
  508. // color: $uni-color-primary;
  509. // margin-bottom: 10rpx;
  510. }
  511. .selected-text {
  512. margin-right: 10rpx;
  513. }
  514. }
  515. }
  516. .attr-list {
  517. display: flex;
  518. flex-direction: column;
  519. font-size: $font-base + 2rpx;
  520. color: $font-color-base;
  521. padding-top: 30rpx;
  522. padding-left: 40rpx;
  523. padding-right: 30rpx;
  524. }
  525. .item-list {
  526. padding: 20rpx 0 0;
  527. display: flex;
  528. flex-wrap: wrap;
  529. .tit {
  530. display: flex;
  531. align-items: center;
  532. justify-content: center;
  533. background: #eee;
  534. // margin-left: 10rpx;
  535. margin-right: 20rpx;
  536. margin-bottom: 20rpx;
  537. border-radius: 100rpx;
  538. min-width: 60rpx;
  539. height: 60rpx;
  540. padding: 0 20rpx;
  541. font-size: $font-base;
  542. color: $font-color-dark;
  543. }
  544. .selected {
  545. background: #fbebee;
  546. color: $uni-color-primary;
  547. }
  548. }
  549. }
  550. /* 弹出层 */
  551. .popup {
  552. position: fixed;
  553. left: 0;
  554. top: 0;
  555. right: 0;
  556. bottom: 0;
  557. z-index: 99;
  558. &.show {
  559. display: block;
  560. .mask {
  561. animation: showPopup 0.2s linear both;
  562. }
  563. .layer {
  564. animation: showLayer 0.2s linear both;
  565. }
  566. }
  567. &.hide {
  568. .mask {
  569. animation: hidePopup 0.2s linear both;
  570. }
  571. .layer {
  572. animation: hideLayer 0.2s linear both;
  573. }
  574. }
  575. &.none {
  576. display: none;
  577. }
  578. .mask {
  579. position: fixed;
  580. top: 0;
  581. width: 100%;
  582. height: 100%;
  583. z-index: 1;
  584. background-color: rgba(0, 0, 0, 0.4);
  585. }
  586. .layer {
  587. position: fixed;
  588. z-index: 99;
  589. bottom: 0;
  590. width: 100%;
  591. min-height: 30vh;
  592. border-radius: 10rpx 10rpx 0 0;
  593. background-color: #fff;
  594. .btn {
  595. position: absolute;
  596. bottom: 0;
  597. width: 750rpx;
  598. height: 98rpx;
  599. background: #FE5B38;
  600. line-height: 98rpx;
  601. // background: $uni-color-primary;
  602. font-size: $font-base + 2rpx;
  603. color: #fff;
  604. }
  605. }
  606. @keyframes showPopup {
  607. 0% {
  608. opacity: 0;
  609. }
  610. 100% {
  611. opacity: 1;
  612. }
  613. }
  614. @keyframes hidePopup {
  615. 0% {
  616. opacity: 1;
  617. }
  618. 100% {
  619. opacity: 0;
  620. }
  621. }
  622. @keyframes showLayer {
  623. 0% {
  624. transform: translateY(120%);
  625. }
  626. 100% {
  627. transform: translateY(0%);
  628. }
  629. }
  630. @keyframes hideLayer {
  631. 0% {
  632. transform: translateY(0);
  633. }
  634. 100% {
  635. transform: translateY(120%);
  636. }
  637. }
  638. }
  639. /* 底部操作菜单 */
  640. .page-bottom {
  641. position: fixed;
  642. left: 0rpx;
  643. bottom: 0rpx;
  644. z-index: 95;
  645. display: flex;
  646. justify-content: center;
  647. align-items: center;
  648. width: 750rpx;
  649. height: 98rpx;
  650. background: rgba(255, 255, 255, 0.9);
  651. box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  652. // border-radius: 16rpx;
  653. .p-b-btn {
  654. display: flex;
  655. flex-direction: column;
  656. align-items: center;
  657. justify-content: center;
  658. font-size: $font-sm;
  659. color: $font-color-base;
  660. width: 100rpx;
  661. height: 98rpx;
  662. .iconfont {
  663. font-size: 40rpx;
  664. line-height: 48rpx;
  665. color: $font-color-light;
  666. }
  667. &.active,
  668. &.active .iconfont {
  669. color: $uni-color-primary;
  670. }
  671. .icon-fenxiang2 {
  672. font-size: 42rpx;
  673. transform: translateY(-2rpx);
  674. }
  675. .iconlikefill {
  676. font-size: 46rpx;
  677. }
  678. }
  679. .action-btn-group {
  680. display: flex;
  681. height: 98rpx;
  682. // border-radius: 100px;
  683. overflow: hidden;
  684. // margin-left: 20rpx;
  685. position: relative;
  686. // &:after {
  687. // content: '';
  688. // position: absolute;
  689. // top: 50%;
  690. // right: 50%;
  691. // transform: translateY(-50%);
  692. // height: 28rpx;
  693. // width: 0;
  694. // border-right: 1px solid rgba(255, 255, 255, 0.5);
  695. // }
  696. .shoucang {
  697. width: 170rpx;
  698. height: 100rpx;
  699. background: #FFFFFF;
  700. flex-direction: column;
  701. justify-content: center;
  702. image {
  703. width: 36rpx;
  704. height: 35rpx;
  705. }
  706. // box-shadow: 0px 0px 40px 0px rgba(50, 50, 52, 0.06);
  707. }
  708. .action-btn {
  709. flex-shrink: 0;
  710. flex-grow: 1;
  711. display: flex;
  712. align-items: center;
  713. justify-content: center;
  714. width: 580rpx;
  715. height: 100%;
  716. font-size: 34rpx;
  717. padding: 0;
  718. border-radius: 0;
  719. // background: transparent;
  720. background: #ffb238;
  721. &.buy-now-btn {
  722. background-color: #ffb238;
  723. }
  724. &.add-cart-btn {
  725. background: #FD3B39;
  726. }
  727. }
  728. }
  729. }
  730. // 商店头
  731. .shop-box {
  732. background-color: #ffffff;
  733. margin-top: 20rpx;
  734. margin-bottom: 10rpx;
  735. padding: 20rpx;
  736. .shop-img {
  737. border-radius: 300rpx;
  738. height: 80rpx;
  739. width: 80rpx;
  740. margin-right: 20rpx;
  741. }
  742. .shop-button {
  743. border-radius: 100rpx;
  744. padding: 10rpx 20rpx;
  745. color: $color-red;
  746. border: 1px solid $color-red;
  747. font-size: $font-lg;
  748. line-height: 1;
  749. }
  750. }
  751. </style>