productBottom.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="page-bottom">
  3. <!-- <view class="p-b-btn" v-if="!product_id" :class="{ active: goodsObjact.userCollect }"
  4. @click="toFavorite(goodsObjact)">
  5. <text class="iconfont "
  6. :class="{ iconlike: !goodsObjact.userCollect, iconlikefill: goodsObjact.userCollect }"></text>
  7. <text>收藏</text>
  8. </view> -->
  9. <!-- <view class="action-btn-group" v-if="!product_id">
  10. <button type="primary" class=" action-btn no-border buy-now-btn" @click="buy(1)">立即购买</button>
  11. </view> -->
  12. <view class="action-btn-group">
  13. <button type="primary" class="botton" @click="buy(1)">立即购买</button>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import {
  19. collectAdd,
  20. collectDel
  21. } from '@/api/product.js';
  22. export default {
  23. props: {
  24. isVip: {
  25. },
  26. many: {
  27. default: 9
  28. },
  29. goodsObjact: {
  30. default: function() {
  31. return {};
  32. }
  33. },
  34. goodsid: {
  35. default: ''
  36. },
  37. product_id: {
  38. }
  39. },
  40. data() {
  41. return {
  42. };
  43. },
  44. onLoad() {
  45. // seckillGoods({}, this.goodsid).then(function({ data }) {
  46. // obj.list = data;
  47. // console.log(obj.list,'list');
  48. // obj.product_id = data.productValue["默认"].product_id
  49. // console.log(obj.product_id,'徐浩岚');
  50. // });
  51. },
  52. methods: {
  53. buy(type) {
  54. this.$emit('specOPne', type);
  55. },
  56. //收藏
  57. toFavorite(item) {
  58. let obj = this;
  59. console.log(obj.goodsObjact, '信息');
  60. item.userCollect = !item.userCollect;
  61. if (!item.userCollect) {
  62. collectDel({
  63. id: obj.goodsid,
  64. category: 'product'
  65. }).then(function(e) {
  66. uni.showToast({
  67. title: '成功取消收藏',
  68. type: 'top',
  69. duration: 1500
  70. });
  71. });
  72. } else {
  73. collectAdd({
  74. id: obj.goodsid,
  75. category: 'product'
  76. }).then(function(e) {
  77. uni.showToast({
  78. title: '成功加入收藏',
  79. type: 'top',
  80. duration: 1500
  81. });
  82. });
  83. }
  84. }
  85. }
  86. };
  87. </script>
  88. <style lang="scss">
  89. /* 底部操作菜单 */
  90. .page-bottom {
  91. position: fixed;
  92. bottom: 0rpx;
  93. z-index: 95;
  94. display: flex;
  95. justify-content: space-between;
  96. // padding-left: 20rpx;
  97. align-items: center;
  98. width: 750rpx;
  99. height: 96rpx;
  100. background-color: #ffffff;
  101. /* box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  102. border-radius: 16rpx; */
  103. .p-b-btn {
  104. display: flex;
  105. flex-direction: column;
  106. align-items: center;
  107. justify-content: center;
  108. font-size: $font-sm;
  109. color: $font-color-base;
  110. width: 96rpx;
  111. height: 80rpx;
  112. .iconfont {
  113. font-size: 40rpx;
  114. line-height: 48rpx;
  115. color: $font-color-light;
  116. }
  117. &.active,
  118. &.active .iconfont {
  119. color: #FF4C4C;
  120. }
  121. .iconlikefill {
  122. font-size: 46rpx;
  123. }
  124. image {
  125. width: 56rpx;
  126. height: 58rpx;
  127. }
  128. }
  129. .action-btn-group {
  130. display: flex;
  131. height: 85rpx;
  132. overflow: hidden;
  133. // margin-left: 20rpx;
  134. position: relative;
  135. &:after {
  136. content: '';
  137. position: absolute;
  138. top: 50%;
  139. right: 50%;
  140. transform: translateY(-50%);
  141. height: 28rpx;
  142. width: 0;
  143. }
  144. .action-btn {
  145. display: flex;
  146. align-items: center;
  147. justify-content: center;
  148. width: 300rpx;
  149. height: 100%;
  150. font-size: $font-base;
  151. padding: 0;
  152. border-radius: 0;
  153. background: transparent;
  154. &.buy-now-btn {
  155. width: 600rpx;
  156. background-color: #FF4C4C;
  157. }
  158. &.add-cart-btn {
  159. width: 600rpx;
  160. background-color: #FFB238;
  161. }
  162. }
  163. }
  164. .botton {
  165. width: 750rpx;
  166. height: 85rpx;
  167. background: linear-gradient(90deg, #FE6F61 0%, #FF4343 100%);
  168. // border-radius: 43rpx;
  169. line-height: 85rpx;
  170. margin: 0 auto;
  171. font-size: 36rpx;
  172. font-weight: 500;
  173. color: #FFFFFF;
  174. }
  175. }
  176. .p-b-btn {
  177. display: flex;
  178. flex-direction: column;
  179. align-items: center;
  180. justify-content: center;
  181. font-size: $font-sm;
  182. color: $font-color-base;
  183. width: 96rpx;
  184. height: 80rpx;
  185. .iconfont {
  186. font-size: 40rpx;
  187. line-height: 48rpx;
  188. color: $font-color-light;
  189. }
  190. &.active,
  191. &.active .iconfont {
  192. color: $uni-color-primary;
  193. }
  194. .icon-fenxiang2 {
  195. font-size: 42rpx;
  196. transform: translateY(-2rpx);
  197. }
  198. .iconlikefill {
  199. font-size: 46rpx;
  200. }
  201. }
  202. </style>