productBottom.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="page-bottom">
  3. <view class="p-b-btn" @click="shopLi">
  4. <image class="icon" src="../../../static/icon/goodsServer.png" mode="widthFix"></image>
  5. <text>客服</text>
  6. </view>
  7. <view class="p-b-btn" :class="{ active: goodsObjact.userCollect }" @click="setCart(goodsObjact)">
  8. <image class="icon" src="../../../static/icon/goodsAddCart.png" mode="widthFix"></image>
  9. <text>购物车</text>
  10. </view>
  11. <view class="action-btn-group">
  12. <button type="primary" class=" action-btn add-cart-btn margin-r-30" @click="buy(2)">加入购物车</button>
  13. <button type="primary" class=" action-btn buy-now-btn margin-r-30" @click="buy(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. systemStore:{
  33. default: function() {
  34. return {};
  35. }
  36. }
  37. },
  38. data() {
  39. return {};
  40. },
  41. methods: {
  42. // 联系商家
  43. shopLi() {
  44. uni.makePhoneCall({
  45. phoneNumber: this.systemStore.phone //仅为示例
  46. });
  47. },
  48. buy(type) {
  49. this.$emit('specOPne',type);
  50. },
  51. // 加入购物车
  52. setCart(goodsObjact){
  53. uni.switchTab({
  54. url:'/pages/cart/cart'
  55. })
  56. }
  57. //收藏
  58. // toFavorite(item) {
  59. // let obj = this;
  60. // item.userCollect = !item.userCollect;
  61. // if (!item.userCollect) {
  62. // collectDel({ id: obj.goodsid, category: 'product' }).then(function(e) {
  63. // uni.showToast({
  64. // title: '成功取消收藏',
  65. // type: 'top',
  66. // duration: 1500
  67. // });
  68. // });
  69. // } else {
  70. // collectAdd({ id: obj.goodsid, category: 'product' }).then(function(e) {
  71. // uni.showToast({
  72. // title: '成功加入收藏',
  73. // type: 'top',
  74. // duration: 1500
  75. // });
  76. // });
  77. // }
  78. // }
  79. }
  80. };
  81. </script>
  82. <style lang="scss">
  83. /* 底部操作菜单 */
  84. .page-bottom {
  85. position: fixed;
  86. bottom: 0rpx;
  87. z-index: 95;
  88. display: flex;
  89. justify-content: center;
  90. align-items: center;
  91. width: 750rpx;
  92. height: 120rpx;
  93. background-color: #ffffff;
  94. /* box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  95. border-radius: 16rpx; */
  96. .icon{
  97. width: 50rpx ;
  98. }
  99. .p-b-btn {
  100. display: flex;
  101. flex-direction: column;
  102. align-items: center;
  103. justify-content: center;
  104. font-size: $font-sm;
  105. color: $font-color-base;
  106. width: 96rpx;
  107. height: 80rpx;
  108. .iconfont {
  109. font-size: 40rpx;
  110. line-height: 48rpx;
  111. color: $font-color-light;
  112. }
  113. &.active,
  114. &.active .iconfont {
  115. color: $uni-color-primary;
  116. }
  117. .iconlikefill {
  118. font-size: 46rpx;
  119. }
  120. image {
  121. width: 56rpx;
  122. height: 58rpx;
  123. }
  124. }
  125. .action-btn-group {
  126. display: flex;
  127. height: 76rpx;
  128. border-radius: 100px;
  129. overflow: hidden;
  130. margin-left: 20rpx;
  131. position: relative;
  132. flex-grow: 1;
  133. &:after {
  134. content: '';
  135. position: absolute;
  136. top: 50%;
  137. right: 50%;
  138. transform: translateY(-50%);
  139. height: 28rpx;
  140. width: 0;
  141. border-right: 1px solid rgba(255, 255, 255, 0.5);
  142. }
  143. .action-btn {
  144. display: flex;
  145. align-items: center;
  146. justify-content: center;
  147. width: 250rpx;
  148. height: 100%;
  149. font-size: $font-base;
  150. padding: 0;
  151. border-radius: 100px;
  152. flex-grow: 1;
  153. background: transparent;
  154. &.buy-now-btn {
  155. background-color: $color-yellow;
  156. color: #714D01;
  157. }
  158. &.add-cart-btn {
  159. background-color: $color-red;
  160. color:#6C0100 ;
  161. }
  162. }
  163. }
  164. }
  165. .p-b-btn {
  166. display: flex;
  167. flex-direction: column;
  168. align-items: center;
  169. justify-content: center;
  170. font-size: $font-sm;
  171. color: $font-color-base;
  172. width: 96rpx;
  173. height: 80rpx;
  174. .iconfont {
  175. font-size: 40rpx;
  176. line-height: 48rpx;
  177. color: $font-color-light;
  178. }
  179. &.active,
  180. &.active .iconfont {
  181. color: $uni-color-primary;
  182. }
  183. .icon-fenxiang2 {
  184. font-size: 42rpx;
  185. transform: translateY(-2rpx);
  186. }
  187. .iconlikefill {
  188. font-size: 46rpx;
  189. }
  190. }
  191. </style>