景徳镇旅游微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
2.1 KiB

8 months ago
  1. <template>
  2. <view class="action">
  3. <view class="icon">
  4. <image src="/static/image/cart/1.png" mode=""></image>
  5. <view class="num">
  6. {{ cartCheckboxValue.length }}
  7. </view>
  8. </view>
  9. <view class="price">
  10. <view class="count">
  11. 合计
  12. <view class="">
  13. <text>{{ totalPrice }}</text>
  14. </view>
  15. </view>
  16. <view class="text">
  17. {{ cartCheckboxValue.length }}已享受更低优惠
  18. </view>
  19. </view>
  20. <view class="btn">
  21. 去结算
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import { mapState } from 'vuex'
  27. export default {
  28. data() {
  29. return {
  30. }
  31. },
  32. computed: {
  33. totalPrice() {
  34. if (!this.cartCheckboxValue.length) {
  35. return 0
  36. }
  37. let price = 0
  38. this.cartList.forEach(n => {
  39. if (this.cartCheckboxValue.includes(n.id)) {
  40. price += n.price * n.num
  41. }
  42. })
  43. return price
  44. },
  45. ...mapState(['cartList', 'cartCheckboxValue']),
  46. },
  47. methods: {
  48. }
  49. }
  50. </script>
  51. <style scoped lang="scss">
  52. .action {
  53. width: 700rpx;
  54. position: fixed;
  55. bottom: 220rpx;
  56. left: 25rpx;
  57. background-color: #fff;
  58. height: 100rpx;
  59. border-radius: 50rpx;
  60. box-shadow: 0 0 6rpx 6rpx #00000010;
  61. display: flex;
  62. justify-content: center;
  63. align-items: center;
  64. overflow: hidden;
  65. .icon {
  66. position: relative;
  67. width: 80rpx;
  68. height: 80rpx;
  69. margin: 0 20rpx;
  70. image {
  71. width: 80rpx;
  72. height: 80rpx;
  73. }
  74. .num {
  75. position: absolute;
  76. right: 10rpx;
  77. top: 0rpx;
  78. background-color: $uni-color;
  79. color: #fff;
  80. font-size: 18rpx;
  81. border-radius: 50%;
  82. height: 30rpx;
  83. width: 30rpx;
  84. display: flex;
  85. justify-content: center;
  86. align-items: center;
  87. }
  88. }
  89. .price {
  90. .count {
  91. display: flex;
  92. font-size: 26rpx;
  93. align-items: center;
  94. view {
  95. color: $uni-color;
  96. margin-left: 10rpx;
  97. text {
  98. font-size: 32rpx;
  99. font-weight: 900;
  100. }
  101. }
  102. }
  103. .text {
  104. font-size: 20rpx;
  105. color: #717171;
  106. }
  107. }
  108. .btn {
  109. margin-left: auto;
  110. background-color: $uni-color;
  111. height: 100%;
  112. padding: 0 50rpx;
  113. color: #fff;
  114. display: flex;
  115. justify-content: center;
  116. align-items: center;
  117. }
  118. }
  119. </style>