Authored by Aiden Xu

Merge remote-tracking branch 'origin/develop' into develop

... ... @@ -6,10 +6,28 @@ Name | Path | Note
品类 | /cate |
全部分类 | /cate-all |
品牌店铺 | /product/shop?domain=sctest1 |
品牌店铺分享页面 | /product/brand-share?domain=colormad |
商品详情 | /product/{productId} |
资讯列表 | /news |
品牌店铺分享页面 | /product/shop-share?domain=colormad |
商品详情 | /product/{productId} |
新品抢先看 | /product/new |
资讯列表 | /news |
资讯详情 | /news/{newsId} |
个人中心 | /home |
个人信息 | /mydetails |
全部订单 | /home/orders?type=1 |
待付款 | /home/orders?type=2 |
待发货 | /home/orders?type=3 |
待收货 | /home/orders?type=4 |
订单详情 | /home/order-detail?orderCode=xxx |
退货申请 | /home/refund?orderId=160181661 |
收藏商品 | /home/favorite |
收藏品牌 | /home/favorite?tab=brand |
yoho币 | /home/mycurrency |
帮助中心 | /home/help |
帮助中心详情 | /home/help-detail |
意见反馈 | /home/feedback |
关于我们 | /home/about |
--------------------------------------------------------------------------------
----
### order 常亮
... ...
... ... @@ -18,9 +18,8 @@ const router = expressRouter();
// Your controller here
router.get('/', home.index); // 个人中心主页
router.get('/orders', order.orders); // 订单
router.get('/mycurrency', order.coin); // yoho币
router.get('/coin-detail', order.getCoinDetail); // yoho币明细
router.get('/order-detail', order.orderDetail); // 订单详情
router.get('/get-orders', order.getOrderData); // 获取订单数据
router.get('/get-order', order.getOrderDetailData); // 获取订单详情数据
... ... @@ -29,6 +28,9 @@ router.post('/cancel-order', order.cancelOrder); // 取消订单
router.post('/delete-order', order.deleteOrder); // 删除订单
router.post('/confirm-order', order.confirmOrder); // 确认订单
router.get('/mycurrency', order.coin); // yoho币
router.get('/coin-detail', order.getCoinDetail); // yoho币明细
router.get('/help', home.help); // 帮助中心列表页
router.get('/help-detail', home.helpDetail); // 帮助中心详情页
router.get('/feedback', home.feedback); // 个人中心-意见反馈
... ... @@ -59,7 +61,7 @@ router.post('/save-mydetails', home.saveMydetails); // 保存个人信息
router.get('/about', home.about); // 个人中心 - 关于我们
router.get('/logistic', order.logistic); // 个人中心 - 订单物流详情页面
router.get('/logistic', order.logistic); // 个人中心 - 退换货物流设置页面
router.get('/get-order-logistic-date', order.getOrderLogisticdate); // 个人中心 - 订单物流详情数据
module.exports = router;
... ...
This diff could not be displayed because it is too large.
... ... @@ -144,3 +144,40 @@ Vue.filter('formatUnixTime', (value) => {
// return M + '.' + D + ' ' + h + ' ' + ' ' + m + ' ' + s;
return `${M}.${D} ${h}:${m}`;
});
const zhDict = {
color: '颜色',
gender: '性别',
size: '尺寸',
brand: '品牌',
priceRange: '价格',
groupSort: '品类',
discount: '折扣',
style: '风格',
ageLevel: '年龄'
};
const enDict = {
color: 'Color',
gender: 'Gender',
size: 'Size',
brand: 'Brand品牌',
priceRange: 'Price',
groupSort: 'Category',
discount: 'Sale',
style: 'Style',
ageLevel: 'Age'
};
Vue.filter('filter-cn', (value, prefix) => {
prefix = prefix || '';
value = zhDict[value] || '';
return prefix + value || '';
});
Vue.filter('filter-en-cn', value => {
const cn = zhDict[value] || '';
const en = enDict[value] || '';
return en + cn;
});
... ...
... ... @@ -8,7 +8,6 @@
line-height: 1;
text-align: center;
white-space: nowrap;
background-color: $blue;
color: $white;
}
... ...
@use postcss-clearfix;
@use postcss-clearfix ;
.clearfix {
clear: fix;
... ...
... ... @@ -7,6 +7,7 @@
}
.icon {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: "iconfont" !important;
speak: none;
... ... @@ -15,6 +16,7 @@
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
... ...
... ... @@ -32,10 +32,8 @@
&:nth-child($i) {
animation: loading-scale 0.75s $(init)s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);
}
$init: calc(($i + 1) * 0.12);
}
display: inline-block;
margin: 4px;
width: 30px;
... ...
... ... @@ -53,6 +53,7 @@
}
/* stylelint-disable */
/* Generated with Bounce.js. Edit at http://goo.gl/W7f9he */
@keyframes animation {
0% {
... ... @@ -95,4 +96,5 @@
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
}
/* stylelint-enable */
... ...
/* stylelint-disable */
/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Change the default font family in all browsers (opinionated).
* 2. Prevent adjustments of font size after orientation changes in IE and iOS.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove the margin in all browsers (opinionated).
*/
body {
margin: 0;
margin: 0;
}
/* HTML5 display definitions
... ... @@ -28,58 +27,55 @@ body {
* 1. Add the correct display in Edge, IE, and Firefox.
* 2. Add the correct display in IE.
*/
article,
aside,
details, /* 1 */
details,
figcaption,
figure,
footer,
header,
main, /* 2 */
main,
menu,
nav,
section,
summary { /* 1 */
display: block;
summary {
/* 1 */
display: block;
}
/**
* Add the correct display in IE 9-.
*/
audio,
canvas,
progress,
video {
display: inline-block;
display: inline-block;
}
/**
* Add the correct display in iOS 4-7.
*/
audio:not([controls]) {
display: none;
height: 0;
display: none;
height: 0;
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
vertical-align: baseline;
}
/**
* Add the correct display in IE 10-.
* 1. Add the correct display in IE.
*/
template, /* 1 */
template,
[hidden] {
display: none;
display: none;
}
/* Links
... ... @@ -89,20 +85,18 @@ template, /* 1 */
* 1. Remove the gray background on active links in IE 10.
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
*/
a {
background-color: transparent; /* 1 */
-webkit-text-decoration-skip: objects; /* 2 */
background-color: transparent; /* 1 */
-webkit-text-decoration-skip: objects; /* 2 */
}
/**
* Remove the outline on focused links when they are also active or hovered
* in all browsers (opinionated).
*/
a:active,
a:hover {
outline-width: 0;
outline-width: 0;
}
/* Text-level semantics
... ... @@ -112,85 +106,77 @@ a:hover {
* 1. Remove the bottom border in Firefox 39-.
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
*/
b,
strong {
font-weight: inherit;
font-weight: inherit;
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
font-weight: bolder;
}
/**
* Add the correct font style in Android 4.3-.
*/
dfn {
font-style: italic;
font-style: italic;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
font-size: 2em;
margin: 0.67em 0;
}
/**
* Add the correct background and color in IE 9-.
*/
mark {
background-color: #ff0;
color: #000;
background-color: #ff0;
color: #000;
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
bottom: -0.25em;
}
sup {
top: -0.5em;
top: -0.5em;
}
/* Embedded content
... ... @@ -199,17 +185,15 @@ sup {
/**
* Remove the border on images inside links in IE 10-.
*/
img {
border-style: none;
border-style: none;
}
/**
* Hide the overflow in IE.
*/
svg:not(:root) {
overflow: hidden;
overflow: hidden;
}
/* Grouping content
... ... @@ -219,32 +203,29 @@ svg:not(:root) {
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
pre,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct margin in IE 8.
*/
figure {
margin: 1em 40px;
margin: 1em 40px;
}
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/* Forms
... ... @@ -254,41 +235,41 @@ hr {
* 1. Change font properties to `inherit` in all browsers (opinionated).
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
select,
textarea {
font: inherit; /* 1 */
margin: 0; /* 2 */
font: inherit; /* 1 */
margin: 0; /* 2 */
}
/**
* Restore the font weight unset by the previous rule.
*/
optgroup {
font-weight: bold;
font-weight: bold;
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
input {
/* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
select {
/* 1 */
text-transform: none;
}
/**
... ... @@ -296,45 +277,41 @@ select { /* 1 */
* controls in Android 4.
* 2. Correct the inability to style clickable types in iOS and Safari.
*/
button,
html [type="button"], /* 1 */
html [type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button; /* 2 */
-webkit-appearance: button; /* 2 */
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
outline: 1px dotted ButtonText;
}
/**
* Change the border, margin, and padding in all browsers (opinionated).
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
... ... @@ -343,79 +320,72 @@ fieldset {
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Remove the default vertical scrollbar in IE.
*/
textarea {
overflow: auto;
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10-.
* 2. Remove the padding in IE 10-.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding and cancel buttons in Chrome and Safari on OS X.
*/
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
-webkit-appearance: none;
}
/**
* Correct the text style of placeholders in Chrome, Edge, and Safari.
*/
::-webkit-input-placeholder {
color: inherit;
opacity: 0.54;
color: inherit;
opacity: 0.54;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* stylelint-enable */
\ No newline at end of file
... ...
... ... @@ -18,7 +18,7 @@
.item-del {
margin-top: 10px;
border-top: 1px solid #e0e0e0;
color: #5c99e4
color: #5c99e4;
}
}
}
... ...
... ... @@ -33,7 +33,6 @@
right: 0;
margin-left: auto;
margin-right: auto;
}
.icon-label {
... ...
... ... @@ -22,6 +22,7 @@
font-size: 28px;
}
}
.coin-detail {
margin-top: 40px;
... ... @@ -69,6 +70,7 @@
color: #b0b0b0;
}
}
.coin-num {
font-size: 34px;
line-height: 92px;
... ...
... ... @@ -16,7 +16,6 @@
height: 130px;
line-height: 130px;
}
height: 90px;
border-bottom: 1px solid #e0e0e0;
... ...
... ... @@ -6,17 +6,20 @@
padding: 0 30px;
background: #fff;
}
.status-desc {
display: flex;
height: 80px;
line-height: 80px;
color: $white;
background: $black;
p:first-of-type {
flex: 1;
font-size: 34px;
}
}
.exchange-progress {
border-bottom: 1px solid #eee;
... ... @@ -67,9 +70,11 @@
color: #b0b0b0;
}
}
.progress-todo {
padding: 25px 0;
text-align: center;
p:first-of-type {
font-size: 34px;
... ... @@ -83,6 +88,7 @@
}
}
}
.exchange-details {
margin-top: 20px;
border-top: 1px solid #eee;
... ... @@ -101,8 +107,8 @@
color: #b0b0b0;
}
}
}
.exchange-product {
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
... ... @@ -116,6 +122,7 @@
border-bottom: 0 none;
}
}
.img-box {
position: relative;
width: 98px;
... ... @@ -133,11 +140,13 @@
color: $white;
text-align: center;
}
img {
width: 100%;
height: 100%;
}
}
.goods-detail {
flex: 1;
margin: 0 20px;
... ... @@ -146,6 +155,7 @@
span {
margin-right: 40px;
}
.name {
display: -webkit-box;
-webkit-line-clamp: 2;
... ... @@ -156,30 +166,36 @@
overflow: hidden;
font-size: 28px;
}
.size {
color: #b0b0b0;
}
}
.goods-price {
text-align: right;
p:first-of-type {
font-size: 28px;
}
p:last-of-type {
font-size: 30px;
color: #b0b0b0;
}
}
}
.exchange-reason {
padding: 20px 0;
font-size: 28px;
blockquote {
margin-top: 20px;
color: #b0b0b0;
}
}
.exchange-img {
display: flex;
margin-top: 25px;
... ... @@ -196,6 +212,7 @@
}
}
}
.exchange-address {
position: relative;
padding: 20px 30px 27px;
... ... @@ -211,14 +228,17 @@
margin-right: 40px;
}
}
p:last-of-type {
font-size: 28px;
color: #b0b0b0;
}
}
.exchange-express {
margin-top: 20px;
}
.exchange-order,
.exchange-type {
display: flex;
... ... @@ -233,8 +253,10 @@
.primary {
flex: 1;
}
.cell-ft {
color: #b0b0b0;
&:after {
content: "\e607";
display: inline-block;
... ... @@ -248,6 +270,7 @@
}
}
}
.exchange-options {
position: fixed;
left: 0;
... ... @@ -275,16 +298,19 @@
color: $white;
background: $black;
}
&.countdown {
color: $white;
background: $black;
}
&.normal {
width: 188px;
padding: 0;
border: 1px solid $black;
color: $black;
}
&:focus {
outline: none;
}
... ...
... ... @@ -10,7 +10,7 @@
background: resolve("home/header-bg.png");
background-size: cover;
.setting {
.setting {
float: left;
margin-top: 30px;
margin-left: 15px;
... ...
... ... @@ -94,11 +94,15 @@
border: none;
}
input::-webkit-input-placeholder { /* WebKit browsers */
input::-webkit-input-placeholder {
/* WebKit browsers */
text-align: center;
}
input:-ms-input-placeholder { /* Internet Explorer 10+ */
input:-ms-input-placeholder {
/* Internet Explorer 10+ */
text-align: center;
}
}
... ...
... ... @@ -42,6 +42,7 @@ body {
font-size: 34px;
font-weight: 700;
}
p:last-of-type {
font-size: 28px;
color: #b0b0b0;
... ... @@ -63,10 +64,12 @@ body {
margin-right: 40px;
}
}
p:last-of-type {
font-size: 28px;
color: #b0b0b0;
}
&:after {
content: "";
position: absolute;
... ... @@ -78,6 +81,7 @@ body {
border-bottom: 1px solid #eee;
}
}
.order-goods {
padding-top: 20px;
border-top: 1px solid #eee;
... ... @@ -92,6 +96,7 @@ body {
border-bottom: 0 none;
}
}
.img-box {
position: relative;
width: 98px;
... ... @@ -109,11 +114,13 @@ body {
color: $white;
text-align: center;
}
img {
width: 100%;
height: 100%;
}
}
.goods-detail {
flex: 1;
margin: 0 20px;
... ... @@ -122,6 +129,7 @@ body {
span {
margin-right: 40px;
}
.name {
display: -webkit-box;
-webkit-line-clamp: 2;
... ... @@ -132,22 +140,26 @@ body {
overflow: hidden;
font-size: 28px;
}
.size {
color: #b0b0b0;
}
}
.goods-price {
text-align: right;
p:first-of-type {
font-size: 28px;
}
p:last-of-type {
font-size: 30px;
color: #b0b0b0;
}
}
}
.order-amount {
padding: 30px 20px;
margin-bottom: 20px;
... ... @@ -163,11 +175,13 @@ body {
text-align: left;
color: #b0b0b0;
}
span {
display: inline-block;
width: 200px;
text-align: left;
}
&:last-of-type {
font-size: 34px;
... ... @@ -175,9 +189,9 @@ body {
color: $black;
}
}
}
}
.order-button {
position: fixed;
left: 0;
... ... @@ -204,16 +218,19 @@ body {
color: $white;
background: $black;
}
&.countdown {
color: $white;
background: $black;
}
&.normal {
width: 188px;
padding: 0;
border: 1px solid $black;
color: $black;
}
&:focus {
outline: none;
}
... ...
... ... @@ -15,6 +15,7 @@ $white: #fff;
margin-top: 0;
}
}
.order-detail {
padding: 0 30px;
... ... @@ -28,6 +29,7 @@ $white: #fff;
}
}
}
.order-code {
height: 88px;
font-size: 34px;
... ... @@ -38,6 +40,7 @@ $white: #fff;
flex: 1;
}
}
.order-goods {
.goods-info {
position: relative;
... ... @@ -58,6 +61,7 @@ $white: #fff;
opacity: 0;
}
}
.img-box {
position: relative;
width: 98px;
... ... @@ -81,6 +85,7 @@ $white: #fff;
height: 100%;
}
}
.goods-detail {
flex: 1;
margin: 0 20px;
... ... @@ -101,10 +106,12 @@ $white: #fff;
overflow: hidden;
font-size: 28px;
}
.size {
color: #b0b0b0;
}
}
.goods-price {
text-align: right;
... ... @@ -118,6 +125,7 @@ $white: #fff;
}
}
}
.order-option {
padding: 30px 0;
border-top: 1px solid #eee;
... ... @@ -145,16 +153,19 @@ $white: #fff;
color: $white;
background: $black;
}
&.countdown {
color: $white;
background: $black;
}
&.normal {
width: 188px;
padding: 0;
border: 1px solid $black;
color: $black;
}
&:focus {
outline: none;
}
... ... @@ -174,6 +185,7 @@ $white: #fff;
margin-top: 8px;
line-height: 60px;
}
p:nth-child(2) {
font-size: 28px;
line-height: 30px;
... ...
<template>
<div class="header">
<div class="header {{class}}">
<div class="header-left">
<slot name="left">
<i class="icon icon-left" @click="goBack"></i>
... ... @@ -18,7 +18,7 @@
const yoho = require('yoho');
module.exports = {
props: ['title'],
props: ['title', 'class'],
methods: {
goBack() {
yoho.goBack({}, function() {}, function() {});
... ... @@ -40,8 +40,7 @@
line-height: 60px;
font-size: 48px;
background-color: #fff;
.icon,
.icon,
.header-title {
vertical-align: middle;
}
... ...
<template>
<div class="filter-box">
<div class="filter" :class="{ 'filter-open': isVisible}">
<div class="filter-actions">
<a href="javascript:;" class="filter-action" @click="clearVals">清空</a>
... ... @@ -8,18 +9,20 @@
<ul class="filter-cates">
<li class="filter-cate" v-for="classify in config" @click="entrySub($key)">
<i class="icon icon-right right"></i>
<span class="filter-cate-label">{{$key | txt }}</span>
<span class="filter-cate-val">{{params[$key] | unifyTxt $key }}</span>
<span class="filter-cate-label">{{$key | filter-en-cn }}</span>
<span class="filter-cate-val">{{params[$key] && params[$key].name }}</span>
</li>
</ul>
</div>
</div>
<filter-sub :type="subType" :data="config && config[subType]" v-ref:filter-sub @select="setParams"></filter-sub>
</div>
</template>
<script>
const $ = require('yoho-jquery');
const bus = require('common/vue-bus');
const Overlay = require('common/overlay');
const yoho = require('yoho');
const filterSub = require('./filter/filter-sub.vue');
module.exports = {
props: {
... ... @@ -33,9 +36,14 @@
params: {},
// 确定的值
selected: {}
selected: {},
subType: ''
};
},
components: {
filterSub
},
watch: {
isVisible(newVal) {
if (newVal) {
... ... @@ -66,16 +74,12 @@
});
},
entrySub: function(key) {
const urlQuery = $.param({
action: this.action,
f_type: key,
old_val: ''
}).concat('&', decodeURIComponent(location.search).replace(/^\?/, ''));
const url = ['/product/sub-filter', '?', urlQuery].join('');
this.subType = key;
this.$refs.filterSub.isVisible = true;
},
// console.log(location.host+url);
yoho.goNewPage({url});
setParams: function(item) {
this.$set(`params.${this.subType}`, item);
}
},
filters: {
... ... @@ -94,21 +98,6 @@
$.each(val, foo);
txt = arr.join(',');
return txt;
},
txt: function(val) {
const dict = {
color: 'Color颜色',
gender: 'Gender性别',
size: 'Size尺寸',
brand: 'Brand品牌',
priceRange: 'Price价格',
groupSort: 'Category品类',
discount: 'Sale折扣',
style: 'Style风格',
ageLevel: 'Age年龄'
};
return dict[val] || '';
}
},
created() {
... ... @@ -138,6 +127,7 @@
transform: translate3d(100%, 0, 0);
transition: all 0.3s 0.2s;
padding: 0 30px;
overflow: auto;
&.filter-open {
transform: translate3d(0, 0, 0);
... ... @@ -191,4 +181,8 @@
color: $grey;
}
.filter-sub-header {
position: absolute;
}
</style>
... ...
<template>
<div class="filter" :class="{ 'filter-open': isVisible}">
<div class="filter-actions">
<a href="javascript:;" class="filter-action" @click="clearVals">清空</a>
<button class="button button-small filter-action" @click="okAction">确定</button>
</div>
<div class="filter-params">
<ul class="filter-cates">
<li class="filter-cate" v-for="classify in config" @click="entrySub($key)">
<i class="icon icon-right right"></i>
<span class="filter-cate-label">{{$key | txt }}</span>
<span class="filter-cate-val">{{params[$key] | unifyTxt $key }}</span>
</li>
</ul>
</div>
</div>
</template>
<script>
const $ = require('yoho-jquery');
const bus = require('common/vue-bus');
const Overlay = require('common/overlay');
const yoho = require('yoho');
module.exports = {
props: {
config: Object,
isVisible: Boolean,
action: '',
},
data: function() {
return {
// 选择的值
params: {},
// 确定的值
selected: {}
};
},
watch: {
isVisible(newVal) {
if (newVal) {
this.overlay.show();
} else {
this.overlay.hide();
}
}
},
methods: {
clearVals: function() {
// remove all value
this.$set('params', {});
},
/**
* 当二级筛选, 返回数据时, 调用该方法
* @param {[type]} cate [description]
* @param {[type]} val [description]
*/
setCateParams: function(cate, val) {
this.$set(`params.${cate}`, val);
},
okAction: function() {
bus.$emit('filter.change', {
val: this.params,
ref: this._uid
});
},
entrySub: function(key) {
const urlQuery = $.param({
action: this.action,
f_type: key,
old_val: ''
}).concat('&', decodeURIComponent(location.search).replace(/^\?/, ''));
const url = ['/product/sub-filter', '?', urlQuery].join('');
// console.log(location.host+url);
yoho.goNewPage({url});
}
},
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;
},
txt: function(val) {
const dict = {
color: 'Color颜色',
gender: 'Gender性别',
size: 'Size尺寸',
brand: 'Brand品牌',
priceRange: 'Price价格',
groupSort: 'Category品类',
discount: 'Sale折扣',
style: 'Style风格',
ageLevel: 'Age年龄'
};
return dict[val] || '';
}
},
created() {
const self = this;
this.overlay = new Overlay({
disableScrolling: true,
onClose: function() {
self.isVisible = false;
}
});
}
};
</script>
<style>
@import "../../../scss/common/color";
.filter {
position: fixed;
z-index: 1001;
top: 0;
right: 0;
bottom: 0;
left: 20%;
background-color: #fff;
transform: translate3d(100%, 0, 0);
transition: all 0.3s 0.2s;
padding: 0 30px;
&.filter-open {
transform: translate3d(0, 0, 0);
}
}
.filter-actions {
font-size: 34px;
text-align: right;
padding: 45px 0;
}
.filter-action {
font-size: inherit;
margin-left: 40px;
}
.filter-actions,
.filter-cate {
border-bottom: 1px solid $grey;
}
.filter-cates {
list-style: none;
margin: 0;
padding: 0;
}
.filter-cate .icon-right {
margin-left: 24px;
}
.filter-cate,
.icon-right {
height: 118px;
line-height: 118px;
}
.filter-cate-label {
font-size: 36px;
font-weight: bold;
}
.filter-cate-val {
float: right;
font-size: 28px;
}
.filter-cate-val,
.filter-cate .icon {
color: $grey;
}
</style>
... ...
<template>
<div class="filter-detail">
<div class="item" @click="select('')">
<div class="item" @click="select({id: ''})">
<div class="item-inner">所有品牌</div>
</div>
<dl v-for="(key, brands) in data">
<dl v-for="key in orderKeys">
<dt class="index" id="{{key}}">{{key}}</dt>
<dd class="item" v-for="brand in brands" :class="{'active': brand.id === val}" @click="select(brand.id)">
<dd class="item" v-for="brand in data[key]" :class="{'active': brand.id === val}" @click="select(brand)">
<div class="item-inner">{{brand.name}}</div>
</dd>
</dl>
... ... @@ -27,8 +27,8 @@
props: {
val: Number,
data: {
coerce: (data) => {
// 以brand.alif 分组
default: () => { return [];},
coerce(data) {
const res = {};
$.each(data, (index, brand) => {
... ... @@ -38,29 +38,38 @@
res[groupName] = [];
}
res[groupName].push(brand);
});
console.log(res);
return res;
}
}
},
data() {
return {
indexList: []
};
},
watch: {
},
methods: {
select: function(val) {
this.val = val;
this.$dispatch('select', val);
}
},
computed: {
indexList() {
var arr = [];
orderKeys() {
let keys = [];
const self = this;
$.each(this.data, (key, val) => {
arr.push({
index: key,
name: key
});
});
return arr;
keys = Object.keys(this.data).sort();
self.$set('indexList', keys.map(k => {
return {
index: k,
name: k
};
}));
return keys;
}
},
components: {
... ...
<template>
<div>
<brand-filter v-if="type === 'brand'" :data="data" :val.sync="val"></brand-filter>
<normal-filter v-else :data="data" :val.sync="val"></normal-filter>
<div class="filter-sub" :class="{'filter-sub-open': isVisible}">
<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>
</template>
<script>
const $ = require('yoho-jquery');
const parser = require('yoho-qs/parse');
const tip = require('common/tip');
const brandFilter = require('./brand.vue');
const normalFilter = require('./normal.vue');
const cHeader = require('component/header.vue');
const brandFilter = require('./brand.vue');
const normalFilter = require('./normal.vue');
module.exports = {
props: ['type', 'data', 'val'],
components: {
brandFilter,
normalFilter
},
watch: {
val: function(newV, oldV) {
console.log(`type: ${this.type}, value: ${newV}`);
module.exports = {
components: {cHeader, brandFilter, normalFilter},
props: ['type', 'data'],
data() {
return {
isVisible: false
};
},
methods: {
selectItem(item) {
this.hide();
return true;
},
hide() {
console.log('hide');
this.isVisible = false;
}
}
},
created() {
const self = this;
const urlQuery = parser(decodeURIComponent(location.search.replace(/^\?/, '')));
const filterUrl = urlQuery.action;
};
</script>
<style>
@import "../../../../scss/common/_color.css";
this.type = urlQuery.f_type;
this.val = urlQuery.old_val;
.filter-sub {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
transition: all 0.3s;
transform: translate3d(100%, 0, 0);
background-color: $white;
z-index: 2010;
overflow: auto;
delete urlQuery.f_type;
delete urlQuery.old_val;
delete urlQuery.action;
$.get(filterUrl, urlQuery)
.done(result => {
if (!result.data) {
tip('加载失败~');
}
self.$set('data', result.data.filter[self.type]);
})
.fail(()=>{
tip('加载失败~');
});
&.filter-sub-open {
transform: translate3d(0, 0, 0);
}
};
</script>
<style>
@import "../../../../scss/common/_color.css";
}
.filter-detail {
$w: 30px;
... ... @@ -82,4 +87,4 @@ module.exports = {
line-height: 100px;
}
}
</style>
</style>
\ No newline at end of file
... ...
<template>
<div>
<brand-filter v-if="type === 'brand'" :data="data" :val.sync="val"></brand-filter>
<normal-filter v-else :data="data" :val.sync="val"></normal-filter>
</div>
</template>
<script>
const $ = require('yoho-jquery');
const parser = require('yoho-qs/parse');
const tip = require('common/tip');
const brandFilter = require('./brand.vue');
const normalFilter = require('./normal.vue');
module.exports = {
props: ['type', 'data', 'val'],
components: {
brandFilter,
normalFilter
},
watch: {
val: function(newV, oldV) {
console.log(`type: ${this.type}, value: ${newV}`);
}
},
created() {
const self = this;
const urlQuery = parser(decodeURIComponent(location.search.replace(/^\?/, '')));
const filterUrl = urlQuery.action;
this.type = urlQuery.f_type;
this.val = urlQuery.old_val;
delete urlQuery.f_type;
delete urlQuery.old_val;
delete urlQuery.action;
$.get(filterUrl, urlQuery)
.done(result => {
if (!result.data) {
tip('加载失败~');
}
self.$set('data', result.data.filter[self.type]);
})
.fail(()=>{
tip('加载失败~');
});
}
};
</script>
<style>
@import "../../../../scss/common/_color.css";
.filter-detail {
$w: 30px;
list-style: none;
margin: 0;
padding: 0;
font-size: 40px;
color: $grey;
.item,
.index {
margin-left: $w;
margin-right: $w;
border-bottom: 1px solid $division;
}
.index {
font-size: 32px;
font-weight: bold;
color: $black;
height: 60px;
line-height: 60px;
}
.item.active .item-inner {
color: $black;
background-color: #f6f6f6;
}
.item-inner {
margin-left: -$w;
margin-right: -$w;
padding: 0 $w;
height: 100px;
line-height: 100px;
}
}
</style>
... ...
<template>
<div class="filter-detail">
<div class="item" v-for="item in data" :class="{active: item.id === val}" @click="toggleCheck(item.id)">
<div class="item">
<div class="item-inner" @click="select({id:''})">{{type | filter-cn '所有'}}</div>
</div>
<div class="item" v-for="item in data" :class="{active: item.id === val}" @click="select(item)">
<div class="item-inner">
{{item.name}}
</div>
... ... @@ -13,8 +16,8 @@ module.exports = {
props: ['data', 'type', 'val'],
computed: {},
methods: {
toggleCheck: function(val) {
this.val = val;
select: function(val) {
this.$dispatch('select', val);
}
}
};
... ...
... ... @@ -49,7 +49,7 @@
</div>
</div>
</template>
<style class="scss">
<style class="scss" scoped>
$bgcolor: #fff;
.news-page {
... ...
... ... @@ -9,6 +9,7 @@
</div>
</template>
<script>
const $ = require('yoho-jquery');
const Vue = require('yoho-vue');
const lazyload = require('yoho-vue-lazyload');
const infinitScroll = require('yoho-vue-infinite-scroll');
... ... @@ -72,9 +73,8 @@
this.inSearching = true;
$.get(this.url, Object.assign({
order: this.order,
filter: this.filter,
page: nextPage
}, locationQuery))
}, this.filter, locationQuery))
.done(res => {
if (res.code === 200) {
self.page = res.data.page;
... ... @@ -129,9 +129,7 @@
self.search();
});
bus.$on('order.change', function({
val
}) {
bus.$on('order.change', function({val}) {
console.log(val);
self.order = val;
});
... ... @@ -143,21 +141,17 @@
*/
bus.$on('filter.change', function({val}) {
console.log(val);
self.filter = val;
let filter = {};
$.each(val, (type, item) => {
if (item.id) {
filter[type] = item.id;
}
});
self.$set('filter', filter);
self.$refs.filter.isVisible = false;
});
/**
* 筛选组件 打开二级晒寻,通过bridge 打开APP view
* 1. 打开view
* 2. 监听 router.back ,重新设置 筛选值
*/
// bus.$on('filter.sub.show', function({
// val
// }) {
// self.openFilterSub(val);
// });
this.search();
}
};
... ...
... ... @@ -17,6 +17,7 @@
const filter = require('component/product/filter.vue');
const shareSubTitle = '我在BLK发现了一个不错的品牌,赶快来看看吧!';
let locationQuery = qs(decodeURIComponent(location.search.replace(/^\?/, '')));
require('common/vue-filter');
... ... @@ -62,7 +63,9 @@
getShopInfo() {
$.get({
url: '/product/shop/info.json',
data: { domain: this.domain }
data: {
domain: this.domain
}
}).done(result => {
if (result) {
this.shopInfo = result;
... ... @@ -95,11 +98,11 @@
this.inSearching = true;
this.page++;
$.post(this.url, {
sort: this.sort,
filter: this.filter,
$.post(this.url, Object.assign({
order: this.sort,
page: this.page
}).done(result => {
}, this.filter, locationQuery))
.done(result => {
this.productList = result.data.productList;
this.filterConfig = result.data.filter;
}).fail(error => {
... ... @@ -130,13 +133,17 @@
filter
},
created() {
const self = this;
this.getShopInfo();
this.search();
bus.$on('list.paging', () =>{
bus.$on('list.paging', () => {
this.search();
});
bus.$on('sort.change', ({ val }) => {
bus.$on('sort.change', ({
val
}) => {
console.log(val);
this.sort = val;
});
... ... @@ -147,20 +154,19 @@
* 1. 重新搜索
* 2. 关闭 filter 组件
*/
bus.$on('filter.change', ({val}) => {
Object.assign(this.filter, val);
this.search();
this.$refs.filter.isVisible = false;
});
bus.$on('filter.change', function({val}) {
console.log(val);
let filter = {};
/**
* 筛选组件 打开二级晒寻,通过bridge 打开APP view
* 1. 打开view
* 2. 监听 router.back ,重新设置 筛选值
*/
bus.$on('filter.sub.show', ({val}) => {
this.openFilterSub(val);
$.each(val, (type, item) => {
if (item.id) {
filter[type] = item.id;
}
});
self.$set('filter', filter);
self.$refs.filter.isVisible = false;
});
}
};
</script>
... ...