settleBottomBtn.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="container">
  3. <view class="item-box">
  4. <view class="item-left">
  5. <image class="img" src="@/static/images/shopCarts.png"></image>
  6. <view class="edge-box">
  7. <u-badge class="edge" type="warning" max="99" :value="allNumb"></u-badge>
  8. </view>
  9. <view class="left-price">
  10. <p class="price">
  11. <span class="price-symbal">¥</span><span class="price-text1">{{ allPrice }}</span>
  12. <span class="price-text2">¥219</span>
  13. </p>
  14. </view>
  15. </view>
  16. <view class="item-right" @click="handlerSettleBtn"> 去结算 </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import {
  22. addShoppingCart
  23. } from '@/api/client/business.js';
  24. export default {
  25. data() {
  26. return {}
  27. },
  28. props: {
  29. goodsCateList: {
  30. type: Array,
  31. default: []
  32. }
  33. },
  34. computed: {
  35. allPrice() {
  36. let sum = 0
  37. this.goodsCateList.map(rs => {
  38. sum += Number((rs.price).toFixed(2))
  39. })
  40. console.log('@@@@sum', sum);
  41. return sum
  42. },
  43. allNumb() {
  44. return this.goodsCateList.length
  45. }
  46. },
  47. methods: {
  48. // 结算按钮
  49. handlerSettleBtn() {
  50. this.goodsCateList.map(rs => {
  51. addShoppingCart(rs).then(res => {
  52. if (res.code == 200) {
  53. wx.showLoading({
  54. title: '结算中',
  55. })
  56. } else {
  57. uni.showToast({
  58. title: res.message,
  59. icon: 'none'
  60. })
  61. return
  62. }
  63. })
  64. })
  65. setTimeout(()=>{
  66. wx.hideLoading()
  67. this.goodsCateList = []
  68. uni.navigateTo({
  69. url:"/pages/client/clientPackage/uptickOrder"
  70. })
  71. },1500)
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .container {
  78. .item-box {
  79. width: 90%;
  80. height: 80rpx;
  81. margin: 0 auto;
  82. display: flex;
  83. .item-left {
  84. background-color: #222426;
  85. width: 80%;
  86. border-radius: 40rpx 0 0 40rpx;
  87. display: flex;
  88. align-items: center;
  89. position: relative;
  90. .img {
  91. position: absolute;
  92. width: 130rpx;
  93. height: 130rpx;
  94. left: 9%;
  95. top: -70%;
  96. }
  97. .edge-box {
  98. position: absolute;
  99. left: 25%;
  100. top: -55%;
  101. }
  102. .left-price {
  103. margin-left: 30%;
  104. .price {
  105. color: #fff;
  106. font-size: 28rpx;
  107. font-weight: bold;
  108. .price-symbal {
  109. font-size: 28rpx;
  110. }
  111. .price-text1 {
  112. font-size: 34rpx;
  113. }
  114. .price-text2 {
  115. font-size: 24rpx;
  116. color: #999999;
  117. font-style: italic;
  118. text-decoration: line-through;
  119. }
  120. }
  121. }
  122. }
  123. .item-right {
  124. background-color: #FFE339;
  125. width: 20%;
  126. border-radius: 0 40rpx 40rpx 0;
  127. color: #000;
  128. font-size: 30rpx;
  129. font-weight: bold;
  130. display: flex;
  131. align-items: center;
  132. justify-content: center;
  133. }
  134. }
  135. }
  136. </style>