bottomMenu.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template name="menu">
  2. <view class="menu">
  3. <view class="isLower" v-if="disabled">该商品已下架~</view>
  4. <view class="bottom-btn">
  5. <view class="bottom-le">
  6. <view class="item-bt" @click="navSwitchTab('/pages/tabBar/home/index')">
  7. <image src="../../../static/tab-home-current.png"></image>
  8. <text>首页</text>
  9. </view>
  10. <view class="item-bt">
  11. <!-- #ifdef MP-WEIXIN -->
  12. <button class="contact-btn" open-type="contact" @bindcontact="handleContact">
  13. <image src="../../../static/severs@3x.png"></image>
  14. <text>客服</text>
  15. </button>
  16. <!-- #endif -->
  17. </view>
  18. <view class="item-bt" @click="navSwitchTab('/pages/tabBar/cart/cart')">
  19. <image src="../../../static/tab-cart-current.png"></image>
  20. <text>购物车</text>
  21. <text v-if="cartCount !==''"
  22. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  23. :class="[cartCount < 10 ? 'goleft':'']">
  24. {{ cartCount >= 100 ? '99+': cartCount }}
  25. </text>
  26. </view>
  27. </view>
  28. <view class="bottom-ri">
  29. <button
  30. :disabled="disabled"
  31. class="btn btn-cart"
  32. :class="[disabled ? 'disabled':'']"
  33. @tap="btnConfirm('add')">加入购物车</button>
  34. <button
  35. :disabled="disabled"
  36. class="btn btn-bay"
  37. :class="[disabled ? 'disabled':'']"
  38. @tap="btnConfirm('buy')">立即购买</button>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default{
  45. name:'menu',
  46. props:{
  47. goodsData:Object
  48. },
  49. data() {
  50. return{
  51. cartCount:0,
  52. disabled:false
  53. }
  54. },
  55. created() {
  56. this.cartCount = this.goodsData.cartCount
  57. this.disabled = this.goodsData.disabled
  58. },
  59. methods:{
  60. handleContact(e){//跳转客服
  61. console.log(e.detail.query)
  62. },
  63. //点击事件
  64. btnConfirm(type){
  65. console.log(type)
  66. this.$emit('showSpec',type)
  67. },
  68. navSwitchTab(url){
  69. uni.switchTab({
  70. url
  71. });
  72. },
  73. navto(url){
  74. uni.navigateTo({
  75. url
  76. })
  77. },
  78. },
  79. }
  80. </script>
  81. <style lang="scss">
  82. .isLower{
  83. width: 100%;
  84. height: 90rpx;
  85. background-color: rgba(0,0,0,.8);
  86. line-height: 90rpx;
  87. text-align: center;
  88. color: #FFFFFF;
  89. font-size: $font-size-28;
  90. position: fixed;
  91. bottom: 110rpx;
  92. left: 0;
  93. }
  94. .bottom-btn{
  95. width: 100%;
  96. height: 110rpx;
  97. position: fixed;
  98. bottom: 0;
  99. left: 0;
  100. background: #FFFFFF;
  101. z-index: 99;
  102. .bottom-le{
  103. width: 302rpx;
  104. height: 86rpx;
  105. padding:12rpx 24rpx;
  106. float: left;
  107. .item-bt{
  108. width: 86rpx;
  109. height: 100%;
  110. margin-right:22rpx;
  111. display: flex;
  112. float: left;
  113. flex-direction: column;
  114. align-items: center;
  115. font-size: $font-size-24;
  116. color: $text-color;
  117. line-height: 34rpx;
  118. position: relative;
  119. .icon-num{
  120. position: absolute;
  121. right:-9rpx;
  122. top: -9rpx;
  123. }
  124. .icon-num.goleft{
  125. right: 4rpx;
  126. }
  127. &:last-child{
  128. margin-right: 0;
  129. }
  130. image {
  131. width: 40rpx;
  132. height: 40rpx;
  133. margin-bottom: 8rpx;
  134. }
  135. button.contact-btn{
  136. width: 100%;
  137. height: 100%;
  138. margin: 0;
  139. padding: 0;
  140. display: flex;
  141. flex-direction: column;
  142. align-items: center;
  143. box-sizing: border-box;
  144. font-size: $font-size-24;
  145. text-align: center;
  146. text-decoration: none;
  147. line-height: 34rpx;
  148. border-radius: 0;
  149. -webkit-tap-highlight-color: transparent;
  150. overflow: hidden;
  151. color: $text-color;
  152. background-color:#FFFFFF;
  153. }
  154. }
  155. }
  156. .bottom-ri{
  157. width: 400rpx;
  158. height: 100%;
  159. float: left;
  160. display: flex;
  161. .btn{
  162. flex: 1;
  163. width: 200rpx;
  164. line-height: 110rpx;
  165. text-align: center;
  166. font-size: $font-size-28;
  167. color: #FFFFFF;
  168. }
  169. .btn-cart{
  170. background-color: #000000;
  171. }
  172. .btn-cart.disabled{
  173. background-color: #7F7F7F;
  174. }
  175. .btn-bay{
  176. background-color: #FF2A2A;
  177. }
  178. .btn-bay.disabled{
  179. background-color: #FF9494;
  180. }
  181. }
  182. }
  183. .uni-badge--small {
  184. -webkit-transform: scale(.8);
  185. -ms-transform: scale(.8);
  186. transform: scale(.8);
  187. -webkit-transform-origin: center center;
  188. -ms-transform-origin: center center;
  189. transform-origin: center center;
  190. }
  191. .uni-badge {
  192. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  193. -webkit-box-sizing: border-box;
  194. box-sizing: border-box;
  195. font-size: 12px;
  196. line-height: 1;
  197. display: inline-block;
  198. padding: 3px 6px;
  199. color: #333;
  200. border-radius: 100px;
  201. background-color: #f1f1f1;
  202. }
  203. .uni-badge-error {
  204. color: #fff;
  205. background-color: #dd524d;
  206. }
  207. </style>