goods.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="goodsItem" @click="goGoodsDetail(data)">
  3. <view class="list_left">
  4. <!-- <image :src="data.cover" mode="aspectFit"></image> width="360rpx" height="360rpx"-->
  5. <u-image class="goods_img" width="170rpx" height="170rpx" mode="aspectFit" :src="data.cover" error-icon="../../../static/img/quesheng.png"></u-image>
  6. </view>
  7. <view class="list_right">
  8. <view class="goods_title shu-elip-2">{{ data.title }}</view>
  9. <view class="goods_titlesm shu-elip-1" v-if="data.publish">{{data.publish}}</view>
  10. <view class="right_bottom">
  11. <view class="money">
  12. <view class="now">
  13. <text>¥</text>
  14. <text>{{data.price_selling}}</text>
  15. </view>
  16. </view>
  17. <!-- <view class="bottom_right" @click.stop="addCart(data)">
  18. <u-icon name="shopping-cart"></u-icon>
  19. </view> -->
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. name: 'pionts',
  27. props: {
  28. data: {
  29. type: Object,
  30. default: () => {
  31. return {};
  32. }
  33. }
  34. },
  35. methods: {
  36. goGoodsDetail(item) {
  37. uni.navigateTo({
  38. url: '/pages-mall/pages/goods/detail?goodsId='+item.id
  39. });
  40. },
  41. addCart(item){
  42. this.$u.api.addCartAjax({
  43. goods_id:item.id,
  44. nums: 1,
  45. sku_id:1,//1是测试,应该传入skuId,外层没有返回,需要接口返回一下
  46. }).then(({code})=>{
  47. if(code==1){
  48. this.$u.toast('添加购物车成功')
  49. }
  50. })
  51. }
  52. }
  53. };
  54. </script>
  55. <style lang="scss" scoped>
  56. .slot {
  57. position: relative;
  58. }
  59. .money {
  60. display: flex;
  61. align-items: flex-end;
  62. .now {
  63. font-weight: bold;
  64. text:nth-child(1) {
  65. font-size: 20rpx;
  66. color: $app-theme-text-money-color;
  67. }
  68. text:nth-child(2) {
  69. font-size: 30rpx;
  70. color: $app-theme-text-money-color;
  71. }
  72. }
  73. .old {
  74. text {
  75. font-size: 20rpx;
  76. color: $app-theme-card-gray-color;
  77. text-decoration-line: line-through;
  78. }
  79. }
  80. }
  81. .list_item{
  82. padding: 0 25rpx;
  83. }
  84. .goodsItem {
  85. display: flex;
  86. // padding: 24rpx 24rpx 24rpx 24rpx;
  87. padding: 20rpx;
  88. border-bottom: 1rpx solid #efefef;
  89. .list_left {
  90. .goods_img {
  91. width: 170rpx;
  92. height: 170rpx;
  93. }
  94. }
  95. .list_right {
  96. margin-left: 24rpx;
  97. width: 100%;
  98. .goods_title {
  99. font-size: 28rpx;
  100. font-weight: 400;
  101. color: #171717;
  102. height: 3em;
  103. margin-top: 6rpx;
  104. line-height: 1.5;
  105. }
  106. .goods_titlesm{
  107. font-size: 24rpx;
  108. font-weight: 400;
  109. color: #999;
  110. }
  111. .right_bottom {
  112. display: flex;
  113. justify-content: space-between;
  114. align-items: center;
  115. margin-top: 10rpx;
  116. .bottom_left {
  117. display: flex;
  118. align-items: center;
  119. image {
  120. width: 32rpx;
  121. height: 32rpx;
  122. margin-right: 10rpx;
  123. }
  124. span {
  125. font-size: 24rpx;
  126. font-weight: 400;
  127. color: #696969;
  128. line-height: 34rpx;
  129. }
  130. .bottom_num {
  131. font-size: 32rpx;
  132. font-weight: 500;
  133. color: #fd4558;
  134. line-height: 44rpx;
  135. margin-right: 8rpx;
  136. }
  137. }
  138. .bottom_right {
  139. font-size: 40rpx;
  140. font-weight: 400;
  141. text-align: center;
  142. color: $app-theme-color;
  143. // line-height: 56rpx;
  144. // width: 56rpx;
  145. // height: 56rpx;
  146. // background: rgba( $app-theme-color, .6);
  147. // border-radius: 30rpx;
  148. }
  149. }
  150. }
  151. }
  152. </style>