productBottom.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. fail() {
  56. uni.navigateTo({
  57. url:'/pages/cart/cart'
  58. })
  59. }
  60. })
  61. }
  62. //收藏
  63. // toFavorite(item) {
  64. // let obj = this;
  65. // item.userCollect = !item.userCollect;
  66. // if (!item.userCollect) {
  67. // collectDel({ id: obj.goodsid, category: 'product' }).then(function(e) {
  68. // uni.showToast({
  69. // title: '成功取消收藏',
  70. // type: 'top',
  71. // duration: 1500
  72. // });
  73. // });
  74. // } else {
  75. // collectAdd({ id: obj.goodsid, category: 'product' }).then(function(e) {
  76. // uni.showToast({
  77. // title: '成功加入收藏',
  78. // type: 'top',
  79. // duration: 1500
  80. // });
  81. // });
  82. // }
  83. // }
  84. }
  85. };
  86. </script>
  87. <style lang="scss">
  88. /* 底部操作菜单 */
  89. .page-bottom {
  90. position: fixed;
  91. bottom: 0rpx;
  92. z-index: 95;
  93. display: flex;
  94. justify-content: center;
  95. align-items: center;
  96. width: 750rpx;
  97. height: 120rpx;
  98. background-color: #ffffff;
  99. /* box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  100. border-radius: 16rpx; */
  101. .icon{
  102. width: 50rpx ;
  103. }
  104. .p-b-btn {
  105. display: flex;
  106. flex-direction: column;
  107. align-items: center;
  108. justify-content: center;
  109. font-size: $font-sm;
  110. color: $font-color-base;
  111. width: 96rpx;
  112. height: 80rpx;
  113. .iconfont {
  114. font-size: 40rpx;
  115. line-height: 48rpx;
  116. color: $font-color-light;
  117. }
  118. &.active,
  119. &.active .iconfont {
  120. color: $uni-color-primary;
  121. }
  122. .iconlikefill {
  123. font-size: 46rpx;
  124. }
  125. image {
  126. width: 56rpx;
  127. height: 58rpx;
  128. }
  129. }
  130. .action-btn-group {
  131. display: flex;
  132. height: 76rpx;
  133. // border-radius: 100px;
  134. overflow: hidden;
  135. margin-left: 20rpx;
  136. position: relative;
  137. flex-grow: 1;
  138. &:after {
  139. content: '';
  140. position: absolute;
  141. top: 50%;
  142. right: 50%;
  143. transform: translateY(-50%);
  144. height: 28rpx;
  145. width: 0;
  146. border-right: 1px solid rgba(255, 255, 255, 0.5);
  147. }
  148. .action-btn {
  149. display: flex;
  150. align-items: center;
  151. justify-content: center;
  152. width: 250rpx;
  153. height: 100%;
  154. font-size: $font-base;
  155. padding: 0;
  156. // border-radius: 100px;
  157. flex-grow: 1;
  158. background: transparent;
  159. &.buy-now-btn {
  160. background-color: $uni-color-primary;
  161. color: #fff;
  162. }
  163. &.add-cart-btn {
  164. background-color: $color-red;
  165. color:#6C0100 ;
  166. }
  167. }
  168. }
  169. }
  170. .p-b-btn {
  171. display: flex;
  172. flex-direction: column;
  173. align-items: center;
  174. justify-content: center;
  175. font-size: $font-sm;
  176. color: $font-color-base;
  177. width: 96rpx;
  178. height: 80rpx;
  179. .iconfont {
  180. font-size: 40rpx;
  181. line-height: 48rpx;
  182. color: $font-color-light;
  183. }
  184. &.active,
  185. &.active .iconfont {
  186. color: $uni-color-primary;
  187. }
  188. .icon-fenxiang2 {
  189. font-size: 42rpx;
  190. transform: translateY(-2rpx);
  191. }
  192. .iconlikefill {
  193. font-size: 46rpx;
  194. }
  195. }
  196. </style>