Authored by ccbikai

Merge branch 'develop' into release/1.0

... ... @@ -23,7 +23,7 @@ const model = {
const content = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getArticleContent', params);
const brands = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getBrand', params);
const other = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getOtherArticle', Object.assign({
tags: article.data.tag,
tags: article.data ? article.data.tag : {},
offset: 0,
limit: 3
}, params));
... ...
... ... @@ -104,6 +104,13 @@ Vue.filter('convertOrderState', (value) => {
return stateTxt;
});
Vue.filter('toFixed', (value, num) => {
if (typeof value === 'undefined') {
return;
}
return Number(value).toFixed(num || 2);
});
/**
* 转换时间
* yyyy-MM-dd hh:mm:ss
... ...
const Vue = require('vue');
const lazyload = require('vue-lazyload');
const directive = require('common/vue-directive');
const app = require('product/detail/index.vue');
const app = require('editorial/detail.vue');
require('common/vue-filter');
Vue.use(lazyload);
... ...
... ... @@ -202,8 +202,6 @@
}
</style>
<script>
const bus = require('common/vue-bus');
module.exports = {
props: {
category: {
... ... @@ -226,13 +224,7 @@
},
watch: {
category() {
this.$set('cateNavLeftData', this.category);
this.$set('cateNavRightData', this.cateNavLeftData ? this.cateNavLeftData[0].sub : []);
this.$set('rightAll', this.cateNavLeftData ? {
sortId: this.cateNavLeftData[0].relationParameter.sort,
categoryName: this.cateNavLeftData[0].categoryName
} : {});
this.categoryChangeHandler();
}
},
methods: {
... ... @@ -247,11 +239,28 @@
/* 筛选列表使用返回值 */
noJumpReturn(categoryId, categoryName) {
bus.$emit('category.result', {
this.$dispatch('select', {
id: categoryId,
name: categoryName
});
},
categoryChangeHandler() {
if (!this.category.length) {
return;
}
this.$set('cateNavLeftData', this.category);
this.$set('cateNavRightData', this.cateNavLeftData ? this.cateNavLeftData[0].sub : []);
this.$set('rightAll', this.cateNavLeftData ? {
sortId: this.cateNavLeftData[0].relationParameter.sort,
categoryName: this.cateNavLeftData[0].categoryName
} : {});
}
},
created() {
this.categoryChangeHandler();
}
};
</script>
... ...
... ... @@ -23,12 +23,19 @@
const bus = require('common/vue-bus');
const Overlay = require('common/overlay');
const filterSub = require('./filter/filter-sub.vue');
const qs = require('yoho-qs/parse');
let locationQuery = qs(decodeURIComponent(location.search.replace(/^\?/, '')));
let hasSort = !!locationQuery.sort;
const aliasMap = {
groupSort: 'sort'
};
module.exports = {
props: {
config: Object,
isVisible: Boolean,
action: '',
action: ''
},
data: function() {
return {
... ... @@ -60,8 +67,8 @@
showCate: function(cateName, cateVals) {
if (toString.call(cateVals) === '[object Array]') {
if (cateName === 'groupSort') {
// TODO
} else if (cateVals.length > 1) {
return !hasSort;
} else if (cateVals.length >= 1) {
return true;
}
}
... ... @@ -92,10 +99,16 @@
* @param {[type]} val [description]
*/
setParams: function(item) {
this.$set(`params.${this.subType}`, item);
let sortType = this.subType;
aliasMap[this.subType] && (sortType = aliasMap[this.subType]);
this.$set(`params.${sortType}`, item);
},
showLabel: function(key) {
aliasMap[key] && (key = aliasMap[key]);
const newSelected = this.params[key];
const oldSelected = this.selected[key];
... ... @@ -106,24 +119,6 @@
}
}
},
filters: {
unifyTxt: function(val, category) {
let txt = '';
let arr = [];
let foo = $.noop;
if ($.isArray(val)) { // [{categoryName,..},{}..]
foo = (index, obj) => {
arr.push(obj[category + 'Name']);
};
}
$.each(val, foo);
txt = arr.join(',');
return txt;
}
},
created() {
const self = this;
... ...
... ... @@ -3,19 +3,21 @@
<c-header class="filter-sub-header" :title="type | filter-cn '选择'">
<i class="icon icon-left" slot="left" @click="hide"></i>
</c-header>
<div>
<brand-filter v-if="type === 'brand'" :data="data" :val.sync="val" @select="selectItem"></brand-filter>
<normal-filter v-else :data="data" :type="type" :val.sync="val" @select="selectItem"></normal-filter>
</div>
<div class="filter-sub-select">
<brand-filter v-if="type === 'brand'" :data="data" @select="selectItem"></brand-filter>
<normal-filter v-if="type !== 'brand' && type !== 'groupSort'" :data="data" :type="type" @select="selectItem"></normal-filter>
<sort-filter class="filter-detail filter-sort" v-if="type === 'groupSort'" :category="data" @select="selectItem"></sort-filter>
</div>
</div>
</template>
<script>
const cHeader = require('component/header.vue');
const brandFilter = require('./brand.vue');
const normalFilter = require('./normal.vue');
const sortFilter = require('channel/brand-cate.vue');
module.exports = {
components: {cHeader, brandFilter, normalFilter},
components: {cHeader, brandFilter, normalFilter, sortFilter},
props: ['type', 'data'],
data() {
return {
... ... @@ -47,7 +49,6 @@
transform: translate3d(100%, 0, 0);
background-color: $white;
z-index: 2010;
overflow: auto;
&.filter-sub-open {
transform: translate3d(0, 0, 0);
... ... @@ -90,4 +91,30 @@
}
}
.filter-sub-select {
position: absolute;
top: 90px;
left: 0;
right: 0;
bottom: 0;
}
.filter-detail {
height: 100%;
overflow: auto;
}
.filter-sort {
.cate-container {
margin-top: 0;
height: 100%;
}
.content {
height: 100% !important;
}
.sub-level-container {
overflow: auto;
}
}
</style>
\ No newline at end of file
... ...
... ... @@ -4,15 +4,15 @@
<li class="card" v-for="item in data">
<div class="card-pic">
<a href="{{item.productId | goodsUrl}}">
<img v-lazy="item.goodsList[0].imagesUrl | resize 372 499" alt="{{item.productName}}">
<img v-lazy="item.defaultImages | resize 372 499" alt="{{item.productName}}">
</a>
</div>
<div class="card-bd">
<h2 class="card-label">
<a href="{{item.productId | goodsUrl}}" class="line-clamp-2">{{item.productName}}</a>
</h2>
<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>
<span class="good-price" :class="{'old-price': item.marketPrice}" v-if="item.marketPrice">¥ {{item.marketPrice | toFixed}}</span>
<span class="good-price" :class="{'sale-price': item.marketPrice}">¥ {{item.salesPrice | toFixed}}</span>
</div>
</li>
</ul>
... ...
... ... @@ -60,11 +60,11 @@
}, (results)=> {
const result = results[0], misc = results[1];
if (result.code === 200) {
if (result && result.code === 200) {
this.likeCount = result.data;
}
if (misc.code === 200) {
if (misc && misc.code === 200) {
this.isLiked = misc.data.isPraise === 'Y';
}
});
... ... @@ -75,9 +75,9 @@
}, (results)=> {
const result = results[0], misc = results[1];
if (result.code === 200) {
if (result && result.code === 200) {
// TODO:
} if (result.code === 403) {
} if (result && result.code === 403) {
// 未登录
yoho.goLogin('', function() {
this.toggleFavorite();
... ... @@ -86,7 +86,7 @@
});
}
if (misc.code === 200) {
if (misc && misc.code === 200) {
this.isFavorite = misc.data.isFavor === 'Y';
}
});
... ... @@ -109,7 +109,7 @@
},
created() {
$.get(`/editorial/misc_${this.id}.json`).then(result => {
if (result.code === 200) {
if (result && result.code === 200) {
this.isFavorite = result.data.isFavor === 'Y';
this.isLiked = result.data.isPraise === 'Y';
}
... ...
<template>
<shop-top v-bind:shop-info="shopInfo"></shop-top>
<div v-bind:class='{"shop-goods-top": !shopInfo.isBlkShop}'>
<goods-list v-bind:data="productList"></goods-list>
<goods-list v-bind:data="productList" :empty="empty"></goods-list>
</div>
<filter :config="filterConfig" v-ref:filter></filter>
<top-bar v-bind:share-data="shareData"></top-bar>
</template>
<style>
#shop {
.empty-tip {
margin-top: 40px;
}
}
.shop-goods-top {
margin-top: 140px;
}
... ... @@ -53,6 +58,11 @@
inSearching: false
};
},
computed: {
empty: function() {
return this.page !== 0 && !this.productList.length;
}
},
watch: {
/* order 和 filter 改变 都会触发 重新搜索 (想象成清空所有分页) */
... ...
<template>
<div v-if="shopInfo.isBlkShop" class="brand-top-box" v-lazy:background-image="shopInfo.shopBg | resize 750 478">
<div class="brand-bottom">
<img v-if="shopInfo.brandLogo" v-lazy="shopInfo.brandLogo | resize 80 80" alt="{{ shopInfo.shopName }}">
<img v-if="shopInfo.shopLogo" v-lazy="shopInfo.shopLogo | resize 80 80" alt="{{ shopInfo.shopName }}">
<div v-else class="brand-title">{{ shopInfo.shopName }}</div>
<hr>
<div v-show="showMore" transition="brand-intro" v-bind:class="{ 'brand-short': !showMore }">{{ shopInfo.shopIntro }}</div>
... ...