cm-cart-navbar.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="cart-navbar">
  3. <view class="navbar">
  4. <view class="icon iconfont" :class="isCheckedAll ? 'icon-xuanze' : 'icon-weixuanze'" @click="$emit('all')">
  5. <text>全选</text>
  6. </view>
  7. <template v-if="isDeleted">
  8. <view class="control">
  9. <tui-button
  10. type="gray"
  11. width="210rpx"
  12. height="80rpx"
  13. :size="30"
  14. shape="circle"
  15. @click="$emit('cancel')"
  16. >
  17. 取消
  18. </tui-button>
  19. <tui-button
  20. type="base"
  21. width="210rpx"
  22. height="80rpx"
  23. :size="30"
  24. shape="circle"
  25. @click="$emit('remove')"
  26. >
  27. 删除
  28. </tui-button>
  29. </view>
  30. </template>
  31. <template v-else>
  32. <view class="center">
  33. <view class="total">
  34. <text>总价:</text> <text class="price">¥{{ data.finallyPrice | priceFormat }}</text>
  35. <text class="delete" v-if="data.allPrice > data.finallyPrice"
  36. >¥{{ data.allPrice | priceFormat }}</text
  37. >
  38. </view>
  39. <view class="reduce" v-if="data.discountedPrice">
  40. <text class="price" v-if="data.discountedPrice">
  41. 共减¥{{ data.discountedPrice | priceFormat }}
  42. </text>
  43. <text class="detail" @click="popupShow = true">优惠明细</text>
  44. <tui-icon :name="popupShow ? 'arrowup' : 'arrowdown'" color="#fc32b4" size="30rpx"></tui-icon>
  45. </view>
  46. </view>
  47. <tui-button
  48. type="base"
  49. width="210rpx"
  50. height="80rpx"
  51. :size="30"
  52. shape="circle"
  53. @click="$emit('submit')"
  54. >
  55. 去结算({{ data.count }})
  56. </tui-button>
  57. </template>
  58. </view>
  59. <cm-safe-area-bottom v-if="safeArea"></cm-safe-area-bottom>
  60. <!-- 弹出 优惠明细-->
  61. <tui-bottom-popup :zIndex="89" :maskZIndex="88" :show="popupShow">
  62. <template>
  63. <view class="popup-content">
  64. <view class="icon-iconfontguanbi iconfont colse" @click="popupShow = false"></view>
  65. <view class="title">优惠明细</view>
  66. <view class="row">
  67. <text>商品总额</text> <text>¥{{ data.allPrice | priceFormat }}</text>
  68. </view>
  69. <view class="row"> <text>促销满减</text> <text class="reduce">-¥0.00</text> </view>
  70. <view class="row">
  71. <text>优惠券</text> <text class="reduce">-¥{{ data.couponAmount | priceFormat }}</text>
  72. </view>
  73. <view class="row total-price">
  74. <text>总计</text> <text>¥{{ data.finallyPrice | priceFormat }}</text>
  75. </view>
  76. <view class="tip">实际订单金额已结算页为准</view>
  77. <cm-safe-area-bottom v-if="safeArea"></cm-safe-area-bottom>
  78. </view>
  79. </template>
  80. </tui-bottom-popup>
  81. </view>
  82. </template>
  83. <script>
  84. export default {
  85. name: 'cm-cart-navbar',
  86. props: {
  87. safeArea: {
  88. type: Boolean,
  89. default: false
  90. },
  91. isDeleted: {
  92. type: Boolean,
  93. default: false
  94. },
  95. isCheckedAll: {
  96. type: Boolean,
  97. default: false
  98. },
  99. data: {
  100. type: Object,
  101. default: () => {}
  102. }
  103. },
  104. data() {
  105. return {
  106. popupShow: false
  107. }
  108. },
  109. methods: {}
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. .cart-navbar {
  114. @extend .fixed-bottom;
  115. z-index: 90;
  116. background: #fff;
  117. box-sizing: border-box;
  118. border-top: 1rpx solid #eee;
  119. .navbar {
  120. position: relative;
  121. height: 100rpx;
  122. @extend .cm-flex-between;
  123. padding: 0 24rpx;
  124. z-index: 90;
  125. background-color: #fff;
  126. &::after{
  127. content: "";
  128. display: block;
  129. width: 750rpx;
  130. height: 100rpx;
  131. position: absolute;
  132. bottom: -100rpx;
  133. left: 0;
  134. background-color: #fff;
  135. }
  136. .icon {
  137. margin-right: 6rpx;
  138. text {
  139. display: inline-block;
  140. font-size: 30rpx;
  141. margin-left: 4rpx;
  142. color: #333;
  143. }
  144. }
  145. .control {
  146. width: 444rpx;
  147. @extend .cm-flex-between;
  148. }
  149. .total,
  150. .reduce {
  151. .price {
  152. color: #f83c6c;
  153. }
  154. .detail {
  155. color: #f83c6c;
  156. }
  157. }
  158. .total {
  159. font-size: 26rpx;
  160. margin-bottom: 4rpx;
  161. .delete {
  162. font-size: 20rpx;
  163. color: #999999;
  164. text-decoration: line-through;
  165. font-weight: normal;
  166. margin-left: 10rpx;
  167. }
  168. }
  169. .reduce {
  170. font-size: 24rpx;
  171. .price {
  172. margin-right: 32rpx;
  173. }
  174. .detail {
  175. }
  176. }
  177. }
  178. }
  179. .popup-content {
  180. position: relative;
  181. padding: 24rpx;
  182. .colse {
  183. position: absolute;
  184. top: 24rpx;
  185. right: 24rpx;
  186. display: block;
  187. width: 40rpx;
  188. height: 40rpx;
  189. text-align: center;
  190. line-height: 40rpx;
  191. color: #999;
  192. }
  193. .title {
  194. text-align: center;
  195. font-size: 30rpx;
  196. margin-bottom: 30rpx;
  197. }
  198. .row {
  199. @extend .cm-flex-between;
  200. margin-top: 24rpx;
  201. font-size: 26rpx;
  202. .reduce {
  203. color: #f83c6c;
  204. }
  205. &.total-price {
  206. font-weight: bold;
  207. }
  208. }
  209. .tip {
  210. margin-top: 24rpx;
  211. margin-bottom: 30rpx;
  212. font-size: 24rpx;
  213. color: #999999;
  214. }
  215. }
  216. </style>