1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <template>
- <view
- class="div product-info"
- @click="productClick"
- >
- <view class="div wrapper">
- <view class="product-icon-wrapper" :style="'width:'+windowWidth+'px;height:'+windowWidth+'px'"><image mode="aspectFit" class="img product-icon" :src="item.goods_img_480"/></view>
- <text class="span product-title">{{ item.goods_name }}</text>
- <view class="div product-bottom">
- <text class="span product-price">¥<text class="i price">{{ item.goods_promotion_price }}</text></text>
- <text class="span product-buy">已售{{ item.goods_salenum }}件</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { urlencode,getFontSize } from '@/util/common'
- export default {
- name: 'IndexProductBody',
- data () {
- return {
- itemWidth: 0,
- itemHeight: 0,
- showRightBorder: this.index % 2 == 0
- }
- },
- props: ['item', 'index'],
- computed: {
- windowWidth: function () {
- const res = uni.getSystemInfoSync()
- var width=res.windowWidth
- var size=getFontSize()
- return (width-3*.6*size)/2
- },
- },
- methods: {
- productClick: function () {
- uni.navigateTo({ url: '/pages/home/goodsdetail/Goodsdetail'+'?'+urlencode( { goods_id: this.item.goods_id } )})
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .border {
- border-right: 1px solid #f5f5f5;
- }
- .product-info {
- display: flex;
- flex-direction: column;
- justify-content: flex-end;
- box-sizing:border-box;
- .wrapper{
- box-shadow: 0px 2px 4px #ececec;
- margin-left:$pageSpace;
- margin-bottom:.5rem;
- border-radius:.4rem;
- }
- .product-icon {
- align-self: center;
- width:100%;box-sizing:border-box;
- border-radius:.4rem;
- }
- .product-title {
- color: $formInputColor;
- font-size: $subFontSize;
- line-height:.8rem;
- height:1.6rem;
- margin-top: 0.4rem;
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- padding:0 .3rem;
- }
- .product-bottom {
- display: flex;
- justify-content: space-between;
- margin-top:.4rem;
- line-height:1rem;
- padding:0 .3rem;
- padding-bottom:.5rem;
- .product-price {
- color: $primaryColor;
- font-size:$fontSize;
- .price{font-size:$mainFontSize}
- }
- .product-buy {
- color: $descTextColor;
- font-size:$fontSize;
- }
- }
- }
- </style>
|