productBottom.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. <view class="btm-btn">
  17. <button type="primary" class="add-btn" @click="buy(2)">加入购物车</button>
  18. <button type="primary" class="buy-btn" @click="buy(1)">立即购买</button>
  19. </view>
  20. </template>
  21. <script>
  22. import { collectAdd, collectDel } from '@/api/product.js';
  23. export default {
  24. props: {
  25. many: {
  26. default: 9
  27. },
  28. goodsObjact: {
  29. default: function() {
  30. return {};
  31. }
  32. },
  33. goodsid:{
  34. default: ''
  35. }
  36. },
  37. data() {
  38. return {};
  39. },
  40. methods: {
  41. buy(type) {
  42. this.$emit('specOPne',type);
  43. },
  44. //收藏
  45. toFavorite(item) {
  46. let obj = this;
  47. item.userCollect = !item.userCollect;
  48. if (!item.userCollect) {
  49. collectDel({ id: obj.goodsid, category: 'product' }).then(function(e) {
  50. uni.showToast({
  51. title: '成功取消收藏',
  52. type: 'top',
  53. duration: 1500
  54. });
  55. });
  56. } else {
  57. collectAdd({ id: obj.goodsid, category: 'product' }).then(function(e) {
  58. uni.showToast({
  59. title: '成功加入收藏',
  60. type: 'top',
  61. duration: 1500
  62. });
  63. });
  64. }
  65. }
  66. }
  67. };
  68. </script>
  69. <style lang="scss">
  70. /* 底部操作菜单 */
  71. .page-bottom {
  72. position: fixed;
  73. bottom: 0rpx;
  74. z-index: 95;
  75. // display: flex;
  76. // justify-content: space-between;
  77. // align-items: center;
  78. width: 750rpx;
  79. height: 120rpx;
  80. background-color: #ffffff;
  81. /* box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  82. border-radius: 16rpx; */
  83. .p-b-btn {
  84. display: flex;
  85. flex-direction: column;
  86. align-items: center;
  87. justify-content: center;
  88. font-size: $font-sm;
  89. color: $font-color-base;
  90. width: 96rpx;
  91. height: 80rpx;
  92. .iconfont {
  93. font-size: 40rpx;
  94. line-height: 48rpx;
  95. color: $font-color-light;
  96. }
  97. &.active,
  98. &.active .iconfont {
  99. color: $uni-color-primary;
  100. }
  101. .iconlikefill {
  102. font-size: 46rpx;
  103. }
  104. image {
  105. width: 56rpx;
  106. height: 58rpx;
  107. }
  108. }
  109. .action-btn-group {
  110. display: flex;
  111. height: 76rpx;
  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: 270rpx;
  131. height: 100%;
  132. font-size: $font-base;
  133. padding: 0;
  134. border-radius: 0;
  135. background: transparent;
  136. &.buy-now-btn {
  137. background-color: #303e49;
  138. }
  139. &.add-cart-btn {
  140. background-color: $base-color;
  141. }
  142. }
  143. }
  144. }
  145. .p-b-btn {
  146. display: flex;
  147. flex-direction: column;
  148. align-items: center;
  149. justify-content: center;
  150. font-size: $font-sm;
  151. color: $font-color-base;
  152. width: 96rpx;
  153. height: 80rpx;
  154. .iconfont {
  155. font-size: 40rpx;
  156. line-height: 48rpx;
  157. color: $font-color-light;
  158. }
  159. &.active,
  160. &.active .iconfont {
  161. color: $uni-color-primary;
  162. }
  163. .icon-fenxiang2 {
  164. font-size: 42rpx;
  165. transform: translateY(-2rpx);
  166. }
  167. .iconlikefill {
  168. font-size: 46rpx;
  169. }
  170. }
  171. .btm-btn {
  172. z-index: 2;
  173. width: 750rpx;
  174. height: 130rpx;
  175. display: flex;
  176. // justify-content: space-between;
  177. justify-content: space-between;
  178. // justify-content: space-between;
  179. position: fixed;
  180. padding: 20rpx;
  181. bottom: 0;
  182. background-color: #fff;
  183. // z-index: 666;
  184. .add-btn {
  185. width: 339rpx;
  186. height: 90rpx;
  187. border: 1px solid #901B21;
  188. border-radius: 45rpx;
  189. background-color: #fff;
  190. font-size: 36rpx;
  191. font-weight: 500;
  192. color: #901B21;
  193. line-height: 90rpx;
  194. }
  195. .buy-btn {
  196. width: 339rpx;
  197. height: 90rpx;
  198. background: #901B21;
  199. border-radius: 45rpx;
  200. font-size: 36rpx;
  201. font-weight: 500;
  202. color: #901B21;
  203. line-height: 90rpx;
  204. color: #fff;
  205. }
  206. }
  207. </style>