Blame view
src/components/CommodityCard/CommodityCard.vue
2.75 KB
1003c53e8
![]() |
1 |
<template> |
7d6833f2c
|
2 3 |
<view class="card" |
b9fb65756
|
4 |
@tap="toGoods(goods.id?goods.id:goods.pid,goods.sk_id)" |
7d6833f2c
|
5 |
> |
88c0598d3
|
6 7 8 9 10 11 12 |
<easy-loadimage mode="widthFix" :scroll-top="scrollTop" :image-src="goods.imgurl?goods.imgurl:goods.pic" :viewHeight="viewHeight" ></easy-loadimage> <!-- <image |
7d6833f2c
|
13 |
mode="widthFix" |
058f060df
|
14 |
:src="goods.imgurl?goods.imgurl:goods.pic" |
967ce241a
|
15 |
></image> --> |
058f060df
|
16 |
<view class="name">{{goods.name?goods.name:goods.p_name}}</view> |
7d6833f2c
|
17 18 |
<view class="info"> <view class="priceBox"> |
089dce19d
|
19 |
<view class="price">{{goods.old_price ? goods.old_price : (goods.rsSon && goods.rsSon.Min_Price)}}</view> |
7d6833f2c
|
20 |
<view class="originCost"> |
089dce19d
|
21 22 |
<!-- {{goods.price !== undefined?goods.price:goods.real_price}} --> {{goods.real_price ? goods.real_price : parseInt(goods.rsSon && goods.rsSon.Min_Price*(1 + Number(goods.rsSon.discount)/100))}} |
7d6833f2c
|
23 24 25 26 27 |
</view> </view> <view class="trade_num">{{goods.trade_num}}人购买</view> </view> </view> |
1003c53e8
![]() |
28 |
</template> |
fb85b244c
|
29 30 |
<script> |
967ce241a
|
31 32 |
import easyLoadimage from '@/components/EasyLoadimage/EasyLoadimage.vue' // const MockData = require('@/static/easy-loadimage/mock-data.json') |
7d6833f2c
|
33 |
export default { |
88c0598d3
|
34 |
components: { easyLoadimage }, |
7d6833f2c
|
35 36 37 38 39 40 41 42 43 44 45 46 |
props: { /** * 商品数据 */ goods: { id: Number, imgurl: String, name: String, rsSon: Object, originCost: String, price: String, trade_num: String, |
089dce19d
|
47 48 |
goodType: String, }, |
88c0598d3
|
49 50 |
scrollTop: Number, viewHeight: Number, |
7d6833f2c
|
51 52 |
}, created () { |
7d6833f2c
|
53 54 55 |
}, data () { return { |
88c0598d3
|
56 |
|
7d6833f2c
|
57 58 |
} }, |
967ce241a
|
59 |
|
7d6833f2c
|
60 |
methods: { |
a3d2beaa8
|
61 |
toGoods (id, skId) { |
88c0598d3
|
62 |
console.log('---', '../details/details?pid=' + id + '&sk_id=' + skId) |
7d6833f2c
|
63 |
uni.navigateTo({ |
88c0598d3
|
64 |
url: '../details/details?pid=' + id + '&sk_id=' + skId, |
7d6833f2c
|
65 66 |
success: res => {}, fail: () => {}, |
089dce19d
|
67 |
complete: () => {}, |
7d6833f2c
|
68 |
}) |
089dce19d
|
69 70 |
}, }, |
7d6833f2c
|
71 |
} |
1003c53e8
![]() |
72 73 |
</script> |
fb85b244c
|
74 |
<style lang="scss"> |
7d6833f2c
|
75 76 77 78 79 80 |
image { width: 100%; height: 120rpx; } .name { width: 92%; |
37f3387c9
|
81 |
height: 84rpx; |
7d6833f2c
|
82 |
padding: 5px 4%; |
15af636b4
|
83 |
box-sizing: border-box; |
7d6833f2c
|
84 85 86 87 88 |
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; text-align: justify; overflow: hidden; |
156736a2e
|
89 |
font-size: 26rpx; |
7d6833f2c
|
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
color: #333333; } .info { display: flex; justify-content: space-between; align-items: center; width: 92%; padding: 5px 4% 5px 4%; .priceBox { display: flex; justify-content: space-between; align-items: center; .price { color: #eb5d3b; font-size: 28rpx; font-weight: 600; margin-right: 10rpx; } .originCost { text-decoration: line-through; color: #999999; font-size: 20rpx; } } .trade_num { color: #999999; font-size: 20rpx; } } </style> |