productBottom.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. <!-- <view class="p-b-btn" :class="{ active: goodsObjact.userCollect }" @click="toFavorite(goodsObjact)">
  8. <text class="iconfont " :class="{ iconlike: !goodsObjact.userCollect, iconlikefill: goodsObjact.userCollect }"></text>
  9. <text>收藏</text>
  10. </view> -->
  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: center;
  73. align-items: center;
  74. width: 750rpx;
  75. height: 120rpx;
  76. /* box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  77. border-radius: 16rpx; */
  78. .p-b-btn {
  79. display: flex;
  80. flex-direction: column;
  81. align-items: center;
  82. justify-content: center;
  83. font-size: $font-sm;
  84. color: $font-color-base;
  85. width: 96rpx;
  86. height: 80rpx;
  87. .iconfont {
  88. font-size: 40rpx;
  89. line-height: 48rpx;
  90. color: $font-color-light;
  91. }
  92. &.active,
  93. &.active .iconfont {
  94. color: $uni-color-primary;
  95. }
  96. .iconlikefill {
  97. font-size: 46rpx;
  98. }
  99. image {
  100. width: 56rpx;
  101. height: 58rpx;
  102. }
  103. }
  104. .action-btn-group {
  105. display: flex;
  106. height: 76rpx;
  107. border-radius: 100px;
  108. overflow: hidden;
  109. margin-left: 20rpx;
  110. position: relative;
  111. flex-grow: 1;
  112. background: transparent;
  113. &:after {
  114. content: '';
  115. position: absolute;
  116. top: 50%;
  117. right: 50%;
  118. transform: translateY(-50%);
  119. height: 28rpx;
  120. width: 0;
  121. border-right: 1px solid rgba(255, 255, 255, 0.5);
  122. }
  123. .action-btn {
  124. display: flex;
  125. align-items: center;
  126. flex-grow: 1;
  127. justify-content: center;
  128. width: 270rpx;
  129. height: 100%;
  130. font-size: $font-base;
  131. padding: 0;
  132. border-radius: 0;
  133. background: transparent;
  134. &.buy-now-btn {
  135. background: $bg-green-gradual;
  136. }
  137. &.add-cart-btn {
  138. background: $bg-green-gradual;
  139. }
  140. }
  141. }
  142. }
  143. .p-b-btn {
  144. display: flex;
  145. flex-direction: column;
  146. align-items: center;
  147. justify-content: center;
  148. font-size: $font-sm;
  149. color: $font-color-base;
  150. width: 96rpx;
  151. height: 80rpx;
  152. .iconfont {
  153. font-size: 40rpx;
  154. line-height: 48rpx;
  155. color: $font-color-light;
  156. }
  157. &.active,
  158. &.active .iconfont {
  159. color: $uni-color-primary;
  160. }
  161. .icon-fenxiang2 {
  162. font-size: 42rpx;
  163. transform: translateY(-2rpx);
  164. }
  165. .iconlikefill {
  166. font-size: 46rpx;
  167. }
  168. }
  169. </style>