productBottom.vue 4.3 KB

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