productBottom.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="page-bottom">
  3. <navigator url="/pages/index/index" open-type="switchTab" class="p-b-btn">
  4. <text class="iconfont iconhome"></text>
  5. <text>首页</text>
  6. </navigator>
  7. <button class="p-b-btn" open-type="contact">
  8. <view class="iconfont iconfriendadd"></view>
  9. <view class="font">客服</view>
  10. </button>
  11. <view class="action-btn-group">
  12. <button type="primary" class=" action-btn no-border add-cart-btn" @click="buy(2)">加入购物车</button>
  13. <button type="primary" class=" action-btn no-border buy-now-btn" @click="buy(1)">立即购买</button>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import { collectAdd, collectDel } from '@/api/product.js';
  19. export default {
  20. props: {
  21. many: {
  22. default: 9
  23. },
  24. goodsObjact: {
  25. default: function() {
  26. return {};
  27. }
  28. },
  29. goodsid: {
  30. default: ''
  31. }
  32. },
  33. data() {
  34. return {};
  35. },
  36. methods: {
  37. buy(type) {
  38. this.$emit('specOPne', type);
  39. },
  40. //收藏
  41. toFavorite(item) {
  42. let obj = this;
  43. item.userCollect = !item.userCollect;
  44. if (!item.userCollect) {
  45. collectDel({ id: obj.goodsid, category: 'product' }).then(function(e) {
  46. uni.showToast({
  47. title: '成功取消收藏',
  48. type: 'top',
  49. duration: 1500
  50. });
  51. });
  52. } else {
  53. collectAdd({ id: obj.goodsid, category: 'product' }).then(function(e) {
  54. uni.showToast({
  55. title: '成功加入收藏',
  56. type: 'top',
  57. duration: 1500
  58. });
  59. });
  60. }
  61. }
  62. }
  63. };
  64. </script>
  65. <style lang="scss">
  66. /* 底部操作菜单 */
  67. .page-bottom {
  68. position: fixed;
  69. bottom: 0rpx;
  70. z-index: 95;
  71. display: flex;
  72. justify-content: space-between;
  73. padding-left: 20rpx;
  74. align-items: center;
  75. width: 750rpx;
  76. height: 96rpx;
  77. background-color: #ffffff;
  78. /* box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  79. border-radius: 16rpx; */
  80. button {
  81. padding: 0;
  82. background: #ffffff;
  83. }
  84. .p-b-btn::after {
  85. border: none;
  86. background: #ffffff;
  87. height: 0;
  88. width: 0;
  89. }
  90. .p-b-btn {
  91. display: flex;
  92. flex-direction: column;
  93. align-items: center;
  94. justify-content: center;
  95. font-size: $font-sm;
  96. color: $font-color-base;
  97. width: 96rpx;
  98. height: 80rpx;
  99. .iconfont {
  100. font-size: 40rpx;
  101. line-height: 48rpx;
  102. color: $font-color-light;
  103. }
  104. &.active,
  105. &.active .iconfont {
  106. color: $uni-color-primary;
  107. }
  108. .iconlikefill {
  109. font-size: 46rpx;
  110. }
  111. image {
  112. width: 56rpx;
  113. height: 58rpx;
  114. }
  115. .font {
  116. line-height: 1;
  117. }
  118. }
  119. .action-btn-group {
  120. display: flex;
  121. height: 96rpx;
  122. overflow: hidden;
  123. margin-left: 20rpx;
  124. position: relative;
  125. &:after {
  126. content: '';
  127. position: absolute;
  128. top: 50%;
  129. right: 50%;
  130. transform: translateY(-50%);
  131. height: 28rpx;
  132. width: 0;
  133. }
  134. .action-btn {
  135. display: flex;
  136. align-items: center;
  137. justify-content: center;
  138. width: 300rpx;
  139. height: 100%;
  140. font-size: $font-base;
  141. padding: 0;
  142. border-radius: 0;
  143. background: transparent;
  144. &.buy-now-btn {
  145. background-color: #ff3442;
  146. }
  147. &.add-cart-btn {
  148. background-color: #ec6941;
  149. }
  150. }
  151. }
  152. }
  153. .p-b-btn {
  154. display: flex;
  155. flex-direction: column;
  156. align-items: center;
  157. justify-content: center;
  158. font-size: $font-sm;
  159. color: $font-color-base;
  160. width: 96rpx;
  161. height: 80rpx;
  162. .iconfont {
  163. font-size: 40rpx;
  164. line-height: 48rpx;
  165. color: $font-color-light;
  166. }
  167. &.active,
  168. &.active .iconfont {
  169. color: $uni-color-primary;
  170. }
  171. .icon-fenxiang2 {
  172. font-size: 42rpx;
  173. transform: translateY(-2rpx);
  174. }
  175. .iconlikefill {
  176. font-size: 46rpx;
  177. }
  178. }
  179. </style>