景徳镇旅游微信小程序
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.2 KiB

8 months ago
8 months ago
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.shopcar.id)) {
  40. price += n.wares.waresPrice * (n.shopcar.shopcarNumber || 1)
  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. z-index: 99;
  66. .icon {
  67. position: relative;
  68. width: 80rpx;
  69. height: 80rpx;
  70. margin: 0 20rpx;
  71. image {
  72. width: 80rpx;
  73. height: 80rpx;
  74. }
  75. .num {
  76. position: absolute;
  77. right: 10rpx;
  78. top: 0rpx;
  79. background-color: $uni-color;
  80. color: #fff;
  81. font-size: 18rpx;
  82. border-radius: 50%;
  83. height: 30rpx;
  84. width: 30rpx;
  85. display: flex;
  86. justify-content: center;
  87. align-items: center;
  88. }
  89. }
  90. .price {
  91. .count {
  92. display: flex;
  93. font-size: 26rpx;
  94. align-items: center;
  95. view {
  96. color: $uni-color;
  97. margin-left: 10rpx;
  98. text {
  99. font-size: 32rpx;
  100. font-weight: 900;
  101. }
  102. }
  103. }
  104. .text {
  105. font-size: 20rpx;
  106. color: #717171;
  107. }
  108. }
  109. .btn {
  110. margin-left: auto;
  111. background-color: $uni-color;
  112. height: 100%;
  113. padding: 0 50rpx;
  114. color: #fff;
  115. display: flex;
  116. justify-content: center;
  117. align-items: center;
  118. }
  119. }
  120. </style>