CartFloat.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <view class="cart-float">
  3. <view class="clearfix cart-float-in car-f-bg" @click="goPage('/pages/cart/cart', 'switchTab')">
  4. <text class="float_left ibonfont ibongouwuche"></text>
  5. <text class="float_left line"></text>
  6. <text class="float_right">¥{{ cartPrice }}</text>
  7. <text class="cart-num-text car-f-bg" v-if="cartNum > 0">{{ cartNum }}</text>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {};
  15. },
  16. computed: {
  17. cartPrice() {
  18. return this.$store.state.cartPrice || 0;
  19. },
  20. cartNum() {
  21. return this.$store.state.cartNum;
  22. }
  23. }
  24. };
  25. </script>
  26. <style lang="scss">
  27. .cart-float {
  28. color: #fff;
  29. position: fixed;
  30. left: 50upx;
  31. bottom: 50upx;
  32. .cart-float-in {
  33. padding: 0 24rpx;
  34. height: 58rpx;
  35. line-height: 58rpx;
  36. background: linear-gradient(136deg, #FD9D00 0%, #FF846C 100%);
  37. border-radius: 36rpx;
  38. text {
  39. font-size: 20upx;
  40. }
  41. .ibonfont {
  42. font-size: 36rpx;
  43. }
  44. .line{
  45. display: block;
  46. width: 2rpx;
  47. height: 32rpx;
  48. background: #FFFFFF;
  49. border-radius: 2rpx;
  50. opacity: 0.6;
  51. margin: 13rpx 12rpx;
  52. }
  53. .cart-num-text {
  54. position: absolute;
  55. display: block;
  56. min-width: 28upx;
  57. height: 30upx;
  58. text-align: center;
  59. background: #fff;
  60. line-height: 28upx;
  61. border-radius: 16rpx;
  62. left: 26upx;
  63. top: -23upx;
  64. font-size: 18upx;
  65. color: #ffffff;
  66. border: 2rpx solid #ffffff;
  67. padding: 0 4rpx;
  68. }
  69. }
  70. }
  71. </style>