bottomMenu.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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/home')">
  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. console.log(this.cartCount)
  59. console.log(this.goodsData)
  60. },
  61. methods:{
  62. handleContact(e){//跳转客服
  63. console.log(e.detail.path)
  64. console.log(e.detail.query)
  65. },
  66. //点击事件
  67. btnConfirm(type){
  68. console.log(type)
  69. this.$emit('showSpec',type)
  70. },
  71. navSwitchTab(url){
  72. uni.switchTab({
  73. url
  74. });
  75. },
  76. navto(url){
  77. uni.navigateTo({
  78. url
  79. })
  80. },
  81. },
  82. }
  83. </script>
  84. <style lang="scss">
  85. .isLower{
  86. width: 100%;
  87. height: 90rpx;
  88. background-color: rgba(0,0,0,.8);
  89. line-height: 90rpx;
  90. text-align: center;
  91. color: #FFFFFF;
  92. font-size: $font-size-28;
  93. position: fixed;
  94. bottom: 110rpx;
  95. left: 0;
  96. }
  97. .bottom-btn{
  98. width: 100%;
  99. height: 110rpx;
  100. position: fixed;
  101. bottom: 0;
  102. left: 0;
  103. background: #FFFFFF;
  104. z-index: 99;
  105. .bottom-le{
  106. width: 302rpx;
  107. height: 86rpx;
  108. padding:12rpx 24rpx;
  109. float: left;
  110. .item-bt{
  111. width: 86rpx;
  112. height: 100%;
  113. margin-right:22rpx;
  114. display: flex;
  115. float: left;
  116. flex-direction: column;
  117. align-items: center;
  118. font-size: $font-size-24;
  119. color: $text-color;
  120. line-height: 34rpx;
  121. position: relative;
  122. .icon-num{
  123. position: absolute;
  124. right:-9rpx;
  125. top: -9rpx;
  126. }
  127. .icon-num.goleft{
  128. right: 4rpx;
  129. }
  130. &:last-child{
  131. margin-right: 0;
  132. }
  133. image {
  134. width: 40rpx;
  135. height: 40rpx;
  136. margin-bottom: 8rpx;
  137. }
  138. button.contact-btn{
  139. width: 100%;
  140. height: 100%;
  141. margin: 0;
  142. padding: 0;
  143. display: flex;
  144. flex-direction: column;
  145. align-items: center;
  146. box-sizing: border-box;
  147. font-size: $font-size-24;
  148. text-align: center;
  149. text-decoration: none;
  150. line-height: 34rpx;
  151. border-radius: 0;
  152. -webkit-tap-highlight-color: transparent;
  153. overflow: hidden;
  154. color: $text-color;
  155. background-color:#FFFFFF;
  156. }
  157. }
  158. }
  159. .bottom-ri{
  160. width: 400rpx;
  161. height: 100%;
  162. float: left;
  163. display: flex;
  164. .btn{
  165. flex: 1;
  166. width: 200rpx;
  167. line-height: 110rpx;
  168. text-align: center;
  169. font-size: $font-size-28;
  170. color: #FFFFFF;
  171. }
  172. .btn-cart{
  173. background-color: #000000;
  174. }
  175. .btn-cart.disabled{
  176. background-color: #7F7F7F;
  177. }
  178. .btn-bay{
  179. background-color: #FF2A2A;
  180. }
  181. .btn-bay.disabled{
  182. background-color: #FF9494;
  183. }
  184. }
  185. }
  186. .uni-badge--small {
  187. -webkit-transform: scale(.8);
  188. -ms-transform: scale(.8);
  189. transform: scale(.8);
  190. -webkit-transform-origin: center center;
  191. -ms-transform-origin: center center;
  192. transform-origin: center center;
  193. }
  194. .uni-badge {
  195. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  196. -webkit-box-sizing: border-box;
  197. box-sizing: border-box;
  198. font-size: 12px;
  199. line-height: 1;
  200. display: inline-block;
  201. padding: 3px 6px;
  202. color: #333;
  203. border-radius: 100px;
  204. background-color: #f1f1f1;
  205. }
  206. .uni-badge-error {
  207. color: #fff;
  208. background-color: #dd524d;
  209. }
  210. </style>