|
|
<template>
|
|
|
<div class="goods-box">
|
|
|
<ul class="cardlist card-large">
|
|
|
<li class="card" v-for="item in items">
|
|
|
<li class="card" v-for="item in products">
|
|
|
<div class="card-pic">
|
|
|
<a href="">
|
|
|
<img :src="item.img" alt="{{item.name}}">
|
|
|
<img :src="item.goodsList[0].imagesUrl | resize 372 499" alt="{{item.productName}}">
|
|
|
</a>
|
|
|
</div>
|
|
|
<div class="card-bd">
|
|
|
<h2 class="card-label">
|
|
|
<a href="">{{item.label}}</a>
|
|
|
<a href="">{{item.productName}}</a>
|
|
|
</h2>
|
|
|
<span class="good-price" :class="{'old-price': item.market_price}" v-if="item.market_price">¥ {{item.market_price}}</span>
|
|
|
<span class="good-price" :class="{'sale-price': item.market_price}">¥ {{item.sale_price}}</span>
|
|
|
<span class="good-price" :class="{'old-price': item.marketPrice}" v-if="item.marketPrice">¥ {{item.marketPrice}}</span>
|
|
|
<span class="good-price" :class="{'sale-price': item.marketPrice}">¥ {{item.salesPrice}}</span>
|
|
|
</div>
|
|
|
</li>
|
|
|
</ul>
|
...
|
...
|
@@ -23,38 +23,39 @@ let $ = require('yoho-jquery'); |
|
|
|
|
|
module.exports = {
|
|
|
props: {
|
|
|
//请求 地址
|
|
|
/* 请求地址 */
|
|
|
url: {
|
|
|
type: String,
|
|
|
required: true
|
|
|
},
|
|
|
//请求参数
|
|
|
query: Object
|
|
|
query: Object /* 请求参数 */
|
|
|
},
|
|
|
data: function() {
|
|
|
return {
|
|
|
items: []
|
|
|
}
|
|
|
products: []
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
fetch: function() {
|
|
|
let self = this;
|
|
|
|
|
|
$.ajax({
|
|
|
url: this.url,
|
|
|
type: 'POST',
|
|
|
})
|
|
|
.then(data=>{
|
|
|
console.log(data)
|
|
|
})
|
|
|
.then(result => {
|
|
|
self.$set('products', self.products.concat(result.data.productList));
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
ready: function() {
|
|
|
this.fetch()
|
|
|
this.fetch();
|
|
|
},
|
|
|
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
<style>
|
|
|
@import '../../scss/common/color';
|
|
|
@import "../../scss/common/color";
|
|
|
|
|
|
.cardlist {
|
|
|
list-style: none;
|
|
|
margin: 0;
|
...
|
...
|
@@ -69,7 +70,6 @@ module.exports = { |
|
|
&:nth-child(2n) {
|
|
|
margin-right: 0;
|
|
|
}
|
|
|
;
|
|
|
}
|
|
|
.card-pic {
|
|
|
width: 100%;
|
...
|
...
|
@@ -90,7 +90,7 @@ module.exports = { |
|
|
font-size: 24px;
|
|
|
}
|
|
|
.card-label {
|
|
|
margin: 0 0 10px 0;
|
|
|
margin: 0 0 10px;
|
|
|
font-size: inherit;
|
|
|
font-weight: normal;
|
|
|
}
|
...
|
...
|
|