productBottom.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="page-bottom">
  3. <view class="p-b-btn" v-if="!product_id" :class="{ active: goodsObjact.userCollect }" @click="toFavorite(goodsObjact)">
  4. <text class="iconfont " :class="{ iconlike: !goodsObjact.userCollect, iconlikefill: goodsObjact.userCollect }"></text>
  5. <text>收藏</text>
  6. </view>
  7. <view class="action-btn-group" v-if="!product_id" >
  8. <button v-if="isVip!=3" type="primary" class=" action-btn no-border add-cart-btn" @click="buy(2)">加入购物车</button>
  9. <button type="primary" class=" action-btn no-border buy-now-btn" @click="buy(1)">立即购买</button>
  10. </view>
  11. <view class="action-btn-group" v-else>
  12. <button type="primary" class="botton" @click="buy(1)">立即购买</button>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import { collectAdd, collectDel } from '@/api/product.js';
  18. export default {
  19. props: {
  20. isVip:{
  21. },
  22. many: {
  23. default: 9
  24. },
  25. goodsObjact: {
  26. default: function() {
  27. return {};
  28. }
  29. },
  30. goodsid:{
  31. default: ''
  32. },
  33. product_id:{
  34. }
  35. },
  36. data() {
  37. return {
  38. };
  39. },
  40. onLoad(){
  41. // seckillGoods({}, this.goodsid).then(function({ data }) {
  42. // obj.list = data;
  43. // console.log(obj.list,'list');
  44. // obj.product_id = data.productValue["默认"].product_id
  45. // console.log(obj.product_id,'徐浩岚');
  46. // });
  47. },
  48. methods: {
  49. buy(type) {
  50. this.$emit('specOPne',type);
  51. },
  52. //收藏
  53. toFavorite(item) {
  54. let obj = this;
  55. console.log(obj.goodsObjact,'信息');
  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. padding-left: 20rpx;
  87. align-items: center;
  88. width: 750rpx;
  89. height: 96rpx;
  90. background-color: #ffffff;
  91. /* box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  92. border-radius: 16rpx; */
  93. .p-b-btn {
  94. display: flex;
  95. flex-direction: column;
  96. align-items: center;
  97. justify-content: center;
  98. font-size: $font-sm;
  99. color: $font-color-base;
  100. width: 96rpx;
  101. height: 80rpx;
  102. .iconfont {
  103. font-size: 40rpx;
  104. line-height: 48rpx;
  105. color: $font-color-light;
  106. }
  107. &.active,
  108. &.active .iconfont {
  109. color: #FF4C4C;
  110. }
  111. .iconlikefill {
  112. font-size: 46rpx;
  113. }
  114. image {
  115. width: 56rpx;
  116. height: 58rpx;
  117. }
  118. }
  119. .action-btn-group {
  120. display: flex;
  121. height: 85rpx;
  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. width: 600rpx;
  146. background-color: #FF4C4C;
  147. }
  148. &.add-cart-btn {
  149. width: 600rpx;
  150. background-color: #FFB238;
  151. }
  152. }
  153. }
  154. .botton{
  155. width: 691rpx;
  156. height: 85rpx;
  157. background: linear-gradient(90deg, #FE6F61 0%, #FF4343 100%);
  158. border-radius: 43rpx;
  159. line-height: 85rpx;
  160. margin: 0 auto;
  161. font-size: 36rpx;
  162. font-weight: 500;
  163. color: #FFFFFF;
  164. }
  165. }
  166. .p-b-btn {
  167. display: flex;
  168. flex-direction: column;
  169. align-items: center;
  170. justify-content: center;
  171. font-size: $font-sm;
  172. color: $font-color-base;
  173. width: 96rpx;
  174. height: 80rpx;
  175. .iconfont {
  176. font-size: 40rpx;
  177. line-height: 48rpx;
  178. color: $font-color-light;
  179. }
  180. &.active,
  181. &.active .iconfont {
  182. color: $uni-color-primary;
  183. }
  184. .icon-fenxiang2 {
  185. font-size: 42rpx;
  186. transform: translateY(-2rpx);
  187. }
  188. .iconlikefill {
  189. font-size: 46rpx;
  190. }
  191. }
  192. </style>