productBottom.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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)" v-if="is_up==0">加入购物车</button> -->
  13. <button type="primary" class=" action-btn no-border buy-now-btn" @click="buy(1)" :class="{'action': is_up==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. is_up: {
  33. default: 0
  34. }
  35. },
  36. data() {
  37. return {};
  38. },
  39. methods: {
  40. buy(type) {
  41. this.$emit('specOPne',type);
  42. },
  43. //收藏
  44. toFavorite(item) {
  45. let obj = this;
  46. item.userCollect = !item.userCollect;
  47. if (!item.userCollect) {
  48. collectDel({ id: obj.goodsid, category: 'product' }).then(function(e) {
  49. uni.showToast({
  50. title: '成功取消收藏',
  51. type: 'top',
  52. duration: 1500
  53. });
  54. });
  55. } else {
  56. collectAdd({ id: obj.goodsid, category: 'product' }).then(function(e) {
  57. uni.showToast({
  58. title: '成功加入收藏',
  59. type: 'top',
  60. duration: 1500
  61. });
  62. });
  63. }
  64. }
  65. }
  66. };
  67. </script>
  68. <style lang="scss">
  69. /* 底部操作菜单 */
  70. .page-bottom {
  71. position: fixed;
  72. bottom: 0rpx;
  73. z-index: 95;
  74. display: flex;
  75. justify-content: center;
  76. align-items: center;
  77. width: 750rpx;
  78. height: 98rpx;
  79. background-color: #ffffff;
  80. /* box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  81. border-radius: 16rpx; */
  82. .p-b-btn {
  83. display: flex;
  84. flex-direction: column;
  85. align-items: center;
  86. justify-content: center;
  87. font-size: $font-sm;
  88. color: $font-color-base;
  89. width: 96rpx;
  90. height: 80rpx;
  91. .iconfont {
  92. font-size: 40rpx;
  93. line-height: 48rpx;
  94. color: $font-color-light;
  95. }
  96. &.active,
  97. &.active .iconfont {
  98. color: $uni-color-primary;
  99. }
  100. .iconlikefill {
  101. font-size: 46rpx;
  102. }
  103. image {
  104. width: 56rpx;
  105. height: 58rpx;
  106. }
  107. }
  108. .action-btn-group {
  109. display: flex;
  110. height: 98rpx;
  111. // font-size: 36rpx;
  112. // border-radius: 100px;
  113. overflow: hidden;
  114. // margin-left: 20rpx;
  115. position: relative;
  116. &:after {
  117. content: '';
  118. position: absolute;
  119. top: 50%;
  120. right: 50%;
  121. transform: translateY(-50%);
  122. height: 28rpx;
  123. width: 0;
  124. border-right: 1px solid rgba(255, 255, 255, 0.5);
  125. }
  126. .action-btn {
  127. display: flex;
  128. align-items: center;
  129. justify-content: center;
  130. width: 750rpx;
  131. height: 100%;
  132. font-size: 36rpx;
  133. letter-spacing: 8rpx;
  134. font-family: PingFang SC;
  135. font-weight: bold;
  136. padding: 0;
  137. border-radius: 0;
  138. background: transparent;
  139. &.buy-now-btn {
  140. background-color: #d8a668;
  141. }
  142. &.add-cart-btn {
  143. background-color: $base-color;
  144. }
  145. }
  146. .action {
  147. // width: 540rpx;
  148. }
  149. }
  150. }
  151. .p-b-btn {
  152. display: flex;
  153. flex-direction: column;
  154. align-items: center;
  155. justify-content: center;
  156. font-size: $font-sm;
  157. color: $font-color-base;
  158. width: 96rpx;
  159. height: 80rpx;
  160. .iconfont {
  161. font-size: 40rpx;
  162. line-height: 48rpx;
  163. color: $font-color-light;
  164. }
  165. &.active,
  166. &.active .iconfont {
  167. color: $uni-color-primary;
  168. }
  169. .icon-fenxiang2 {
  170. font-size: 42rpx;
  171. transform: translateY(-2rpx);
  172. }
  173. .iconlikefill {
  174. font-size: 46rpx;
  175. }
  176. }
  177. </style>