collection.vue 3.6 KB

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