Authored by 沈志敏

Merge branch 'feature/home' into develop

@@ -24,6 +24,7 @@ const fav = { @@ -24,6 +24,7 @@ const fav = {
24 }, 24 },
25 favpaging: (req, res, next) => { 25 favpaging: (req, res, next) => {
26 let uid = req.user.uid; 26 let uid = req.user.uid;
  27 +
27 uid = 20000134; // 测试uid 28 uid = 20000134; // 测试uid
28 29
29 const tab = req.query.tab; 30 const tab = req.query.tab;
@@ -33,6 +34,7 @@ const fav = { @@ -33,6 +34,7 @@ const fav = {
33 34
34 if (tab === 'brand') { 35 if (tab === 'brand') {
35 const gender = '1,2,3'; // todo 获取频道的性别 36 const gender = '1,2,3'; // todo 获取频道的性别
  37 +
36 favModel.getFavBrandData(uid, gender, page, 10).then(data => { 38 favModel.getFavBrandData(uid, gender, page, 10).then(data => {
37 if (data && page <= data.page_total) { 39 if (data && page <= data.page_total) {
38 data.brand_list.forEach(function(d) { 40 data.brand_list.forEach(function(d) {
@@ -41,7 +43,7 @@ const fav = { @@ -41,7 +43,7 @@ const fav = {
41 link: '', // todo 43 link: '', // todo
42 imgUrl: d.brand_ico ? helpers.image(d.brand_ico, 160, 125) : '', 44 imgUrl: d.brand_ico ? helpers.image(d.brand_ico, 160, 125) : '',
43 brandName: d.brand_name, 45 brandName: d.brand_name,
44 - down: d.status == 0 46 + down: d.status === 0
45 }); 47 });
46 }); 48 });
47 49
@@ -63,6 +65,7 @@ const fav = { @@ -63,6 +65,7 @@ const fav = {
63 } 65 }
64 66
65 let link = ''; 67 let link = '';
  68 +
66 if (d.goodsId && d.cnAlphabet) { 69 if (d.goodsId && d.cnAlphabet) {
67 link = helpers.urlFormat(`/product/pro_${d.product_id}_${d.goodsId}/${d.cnAlphabet}.html`); 70 link = helpers.urlFormat(`/product/pro_${d.product_id}_${d.goodsId}/${d.cnAlphabet}.html`);
68 } 71 }
@@ -75,7 +78,7 @@ const fav = { @@ -75,7 +78,7 @@ const fav = {
75 price: '¥' + Number(Math.max(d.market_price, 0)).toFixed(2), 78 price: '¥' + Number(Math.max(d.market_price, 0)).toFixed(2),
76 discountPrice: (Number(d.market_price) - Number(d.sales_price) > 0) ? '¥' + Number(Math.max(d.sales_price, 0)).toFixed(2) : false, 79 discountPrice: (Number(d.market_price) - Number(d.sales_price) > 0) ? '¥' + Number(Math.max(d.sales_price, 0)).toFixed(2) : false,
77 sellOut: d.storage < 0, 80 sellOut: d.storage < 0,
78 - invalidGoods: d.status == 0 81 + invalidGoods: d.status === 0
79 }); 82 });
80 }); 83 });
81 84
@@ -92,14 +95,16 @@ const fav = { @@ -92,14 +95,16 @@ const fav = {
92 }, 95 },
93 deletefav: (req, res, next) => { 96 deletefav: (req, res, next) => {
94 let uid = req.user.uid; 97 let uid = req.user.uid;
  98 +
95 uid = 20000134; // 测试uid 99 uid = 20000134; // 测试uid
96 100
97 const favId = req.body.favId; 101 const favId = req.body.favId;
98 const type = req.body.type; 102 const type = req.body.type;
  103 +
99 favModel.favoriteDelete(uid, favId, type).then(data => { 104 favModel.favoriteDelete(uid, favId, type).then(data => {
100 return res.json(data); 105 return res.json(data);
101 }).catch(next); 106 }).catch(next);
102 } 107 }
103 -} 108 +};
104 109
105 -module.exports = fav;  
  110 +module.exports = fav;
@@ -16,6 +16,7 @@ const helpers = global.yoho.helpers; @@ -16,6 +16,7 @@ const helpers = global.yoho.helpers;
16 const component = { 16 const component = {
17 index: (req, res, next) => { 17 index: (req, res, next) => {
18 let uid = req.user.uid; 18 let uid = req.user.uid;
  19 +
19 uid = 8050378; // 测试uid 20 uid = 8050378; // 测试uid
20 21
21 if (!uid && req.xhr) { 22 if (!uid && req.xhr) {
@@ -27,7 +28,7 @@ const component = { @@ -27,7 +28,7 @@ const component = {
27 28
28 homeModel.getUserHomeData(uid).then(data => { 29 homeModel.getUserHomeData(uid).then(data => {
29 const proData = data[0]; 30 const proData = data[0];
30 - let result = { 31 + const result = {
31 module: 'home', 32 module: 'home',
32 page: 'index', 33 page: 'index',
33 head_ico: proData && proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '', 34 head_ico: proData && proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '',
@@ -36,6 +37,7 @@ const component = { @@ -36,6 +37,7 @@ const component = {
36 refer: req.originalUrl 37 refer: req.originalUrl
37 }), 38 }),
38 }; 39 };
  40 +
39 res.render('index', _.merge(result, data[1])); 41 res.render('index', _.merge(result, data[1]));
40 }).catch(next); 42 }).catch(next);
41 }, 43 },
@@ -104,6 +106,7 @@ const component = { @@ -104,6 +106,7 @@ const component = {
104 } 106 }
105 }).catch(next); 107 }).catch(next);
106 }, 108 },
  109 +
107 // 关于我们 110 // 关于我们
108 aboutUs: (req, res) => { 111 aboutUs: (req, res) => {
109 res.render('about-us', { 112 res.render('about-us', {
@@ -141,4 +144,4 @@ const component = { @@ -141,4 +144,4 @@ const component = {
141 } 144 }
142 }; 145 };
143 146
144 -module.exports = component;  
  147 +module.exports = component;
@@ -39,16 +39,15 @@ const refund = { @@ -39,16 +39,15 @@ const refund = {
39 res.json(result); 39 res.json(result);
40 }).catch(next); 40 }).catch(next);
41 }, 41 },
42 - saveLogistics(req, res, next) {  
43 - const company_id = req.body.company_id;  
44 - const company_name = req.body.company_name;  
45 - const num = req.body.num;  
46 - 42 + saveLogistics(req, res) {
47 // todo 调用保存物流信息接口 43 // todo 调用保存物流信息接口
  44 + // const companyId = req.body.company_id;
  45 + // const companyName = req.body.company_name;
  46 + // const num = req.body.num;
48 res.json({ 47 res.json({
49 code: 200 48 code: 200
50 }); 49 });
51 } 50 }
52 }; 51 };
53 52
54 -module.exports = refund;  
  53 +module.exports = refund;
@@ -38,8 +38,8 @@ exports.getFavBrandData = (uid, gender, page, limit) => { @@ -38,8 +38,8 @@ exports.getFavBrandData = (uid, gender, page, limit) => {
38 limit: limit 38 limit: limit
39 }).then(result => { 39 }).then(result => {
40 return result.data; 40 return result.data;
41 - })  
42 -} 41 + });
  42 +};
43 43
44 /** 44 /**
45 * 取消收藏的商品/品牌数据 45 * 取消收藏的商品/品牌数据
@@ -56,4 +56,4 @@ exports.favoriteDelete = (uid, favId, type) => { @@ -56,4 +56,4 @@ exports.favoriteDelete = (uid, favId, type) => {
56 type: type, 56 type: type,
57 fav_id: favId 57 fav_id: favId
58 }); 58 });
59 -}  
  59 +};
@@ -32,4 +32,4 @@ const refund = { @@ -32,4 +32,4 @@ const refund = {
32 } 32 }
33 }; 33 };
34 34
35 -module.exports = refund;  
  35 +module.exports = refund;
1 const Vue = require('yoho-vue'); 1 const Vue = require('yoho-vue');
2 const infiniteScroll = require('yoho-vue-infinite-scroll'); 2 const infiniteScroll = require('yoho-vue-infinite-scroll');
3 -const BrandList = require('home/fav-brand-list.vue'); 3 +const favBrandList = require('home/fav-brand-list.vue');
4 4
5 Vue.use(infiniteScroll); 5 Vue.use(infiniteScroll);
6 6
7 new Vue({ 7 new Vue({
8 el: '#fav-content', 8 el: '#fav-content',
9 components: { 9 components: {
10 - 'favBrandList': BrandList 10 + favBrandList
11 } 11 }
12 -});  
  12 +});
1 const Vue = require('yoho-vue'); 1 const Vue = require('yoho-vue');
2 const infiniteScroll = require('yoho-vue-infinite-scroll'); 2 const infiniteScroll = require('yoho-vue-infinite-scroll');
3 -const ProductList = require('home/fav-product-list.vue'); 3 +const favProductList = require('home/fav-product-list.vue');
4 4
5 Vue.use(infiniteScroll); 5 Vue.use(infiniteScroll);
6 6
7 new Vue({ 7 new Vue({
8 el: '#fav-content', 8 el: '#fav-content',
9 components: { 9 components: {
10 - 'favProductList': ProductList 10 + favProductList
11 } 11 }
12 -});  
  12 +});
@@ -23,4 +23,4 @@ new Vue({ @@ -23,4 +23,4 @@ new Vue({
23 this.company_name = obj.company_name; 23 this.company_name = obj.company_name;
24 } 24 }
25 } 25 }
26 -});  
  26 +});
@@ -30,14 +30,14 @@ @@ -30,14 +30,14 @@
30 margin-right: 15px; 30 margin-right: 15px;
31 margin-top: 80px; 31 margin-top: 80px;
32 background: resolve("home/fav/fav-del.png"); 32 background: resolve("home/fav/fav-del.png");
33 - background-size: 100%; 33 + background-size: 100%;
34 } 34 }
35 } 35 }
36 36
37 .delshow { 37 .delshow {
38 display: block; 38 display: block;
39 } 39 }
40 - 40 +
41 .fav-img-box { 41 .fav-img-box {
42 width: 152px; 42 width: 152px;
43 height: 203px; 43 height: 203px;
@@ -71,18 +71,18 @@ @@ -71,18 +71,18 @@
71 71
72 .fav-price { 72 .fav-price {
73 margin-top: 20px; 73 margin-top: 20px;
  74 + }
74 75
75 - .new-price {  
76 - color: #d1021c;  
77 - font-size: 24px;  
78 - }  
79 -  
80 - .price-underline {  
81 - text-decoration: line-through;  
82 - margin-left: 15px;  
83 - color: #b0b0b0;  
84 - font-size: 24px;  
85 - } 76 + .new-price {
  77 + color: #d1021c;
  78 + font-size: 24px;
  79 + }
  80 +
  81 + .price-underline {
  82 + text-decoration: line-through;
  83 + margin-left: 15px;
  84 + color: #b0b0b0;
  85 + font-size: 24px;
86 } 86 }
87 87
88 .save-price { 88 .save-price {
@@ -91,16 +91,14 @@ @@ -91,16 +91,14 @@
91 left: 0; 91 left: 0;
92 width: 100%; 92 width: 100%;
93 min-height: 24px; 93 min-height: 24px;
  94 + }
94 95
95 - span {  
96 - &.sell-out {  
97 - float: right;  
98 - padding: 5px 18px;  
99 - color: #b0b0b0;  
100 - border-radius: 20px;  
101 - font-size: 22px;  
102 - }  
103 - } 96 + .sell-out {
  97 + float: right;
  98 + padding: 5px 18px;
  99 + color: #b0b0b0;
  100 + border-radius: 20px;
  101 + font-size: 22px;
104 } 102 }
105 } 103 }
106 } 104 }
@@ -113,13 +111,13 @@ @@ -113,13 +111,13 @@
113 text-align: center; 111 text-align: center;
114 112
115 &:before { 113 &:before {
116 - content: ''; 114 + content: "";
117 display: block; 115 display: block;
118 width: 188px; 116 width: 188px;
119 height: 171px; 117 height: 171px;
120 background: resolve("home/fav/fav-null.png"); 118 background: resolve("home/fav/fav-null.png");
121 background-size: 100% 100%; 119 background-size: 100% 100%;
122 - margin: 0 auto 45px auto; 120 + margin: 0 auto 45px;
123 } 121 }
124 } 122 }
125 123
@@ -127,13 +125,13 @@ @@ -127,13 +125,13 @@
127 width: 472px; 125 width: 472px;
128 height: 88px; 126 height: 88px;
129 line-height: 88px; 127 line-height: 88px;
130 - margin: 80px auto 0 auto; 128 + margin: 80px auto 0;
131 background: #444; 129 background: #444;
132 text-align: center; 130 text-align: center;
133 color: #fff; 131 color: #fff;
134 display: block; 132 display: block;
135 font-size: 26px; 133 font-size: 26px;
136 - border-radius:.2rem; 134 + border-radius: 0.2rem;
137 } 135 }
138 } 136 }
139 } 137 }
@@ -178,7 +176,7 @@ @@ -178,7 +176,7 @@
178 .delshow { 176 .delshow {
179 display: block; 177 display: block;
180 } 178 }
181 - 179 +
182 .fav-img-box { 180 .fav-img-box {
183 width: 160px; 181 width: 160px;
184 height: 125px; 182 height: 125px;
@@ -232,13 +230,13 @@ @@ -232,13 +230,13 @@
232 text-align: center; 230 text-align: center;
233 231
234 &:before { 232 &:before {
235 - content: ''; 233 + content: "";
236 display: block; 234 display: block;
237 width: 188px; 235 width: 188px;
238 height: 171px; 236 height: 171px;
239 background: resolve("home/fav/fav-null.png"); 237 background: resolve("home/fav/fav-null.png");
240 background-size: 100% 100%; 238 background-size: 100% 100%;
241 - margin: 0 auto 45px auto; 239 + margin: 0 auto 45px;
242 } 240 }
243 } 241 }
244 242
@@ -246,13 +244,13 @@ @@ -246,13 +244,13 @@
246 width: 472px; 244 width: 472px;
247 height: 88px; 245 height: 88px;
248 line-height: 88px; 246 line-height: 88px;
249 - margin: 80px auto 0 auto; 247 + margin: 80px auto 0;
250 background: #444; 248 background: #444;
251 text-align: center; 249 text-align: center;
252 color: #fff; 250 color: #fff;
253 display: block; 251 display: block;
254 font-size: 26px; 252 font-size: 26px;
255 - border-radius:.2rem; 253 + border-radius: 0.2rem;
256 } 254 }
257 } 255 }
258 -}  
  256 +}
@@ -14,9 +14,9 @@ @@ -14,9 +14,9 @@
14 font-size: 34px; 14 font-size: 34px;
15 line-height: 138px; 15 line-height: 138px;
16 height: 469px; 16 height: 469px;
17 - background-size: cover;  
18 - background: resolve("home/header-bg.png");  
19 text-align: center; 17 text-align: center;
  18 + background: resolve("home/header-bg.png");
  19 + background-size: cover;
20 20
21 .user-avatar { 21 .user-avatar {
22 display: inline-block; 22 display: inline-block;
@@ -6,6 +6,4 @@ @@ -6,6 +6,4 @@
6 @import "order"; 6 @import "order";
7 @import "coin"; 7 @import "coin";
8 @import "logistics"; 8 @import "logistics";
9 -/*@import "order-detail";*/  
10 -  
11 - 9 +/* @import "order-detail"; */
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 background: #fff; 13 background: #fff;
14 font-size: 30px; 14 font-size: 30px;
15 line-height: 88px; 15 line-height: 88px;
16 - 16 +
17 label { 17 label {
18 display: block; 18 display: block;
19 position: relative; 19 position: relative;
@@ -25,15 +25,16 @@ @@ -25,15 +25,16 @@
25 content: none; 25 content: none;
26 } 26 }
27 27
28 - .company-val { 28 + .company-val {
29 direction: rtl; 29 direction: rtl;
30 margin-right: 10px; 30 margin-right: 10px;
31 - }  
32 - .icon { 31 + }
  32 +
  33 + .icon {
33 margin-top: 27px; 34 margin-top: 27px;
34 margin-right: 10px; 35 margin-right: 10px;
35 float: right; 36 float: right;
36 - } 37 + }
37 } 38 }
38 39
39 input { 40 input {
@@ -41,14 +42,13 @@ @@ -41,14 +42,13 @@
41 top: 0; 42 top: 0;
42 right: 40px; 43 right: 40px;
43 width: 360px; 44 width: 360px;
44 - height: 88px; 45 + height: 86px;
45 color: #444; 46 color: #444;
46 padding: 0; 47 padding: 0;
47 border: none; 48 border: none;
48 -webkit-appearance: none; 49 -webkit-appearance: none;
49 } 50 }
50 51
51 -  
52 .num { 52 .num {
53 width: 440px; 53 width: 440px;
54 text-align: right; 54 text-align: right;
@@ -80,15 +80,15 @@ @@ -80,15 +80,15 @@
80 .search-input { 80 .search-input {
81 position: relative; 81 position: relative;
82 text-align: center; 82 text-align: center;
83 - padding: 16px 16px; 83 + padding: 16px;
84 border-bottom: 1px solid #e6e6e6; 84 border-bottom: 1px solid #e6e6e6;
85 85
86 input { 86 input {
87 height: 56px; 87 height: 56px;
88 width: 100%; 88 width: 100%;
89 - padding-left: 15px; 89 + padding-left: 25px;
90 border-radius: 20px; 90 border-radius: 20px;
91 - font-size: 36px; 91 + font-size: 22px;
92 color: #b0b0b0; 92 color: #b0b0b0;
93 background: #eee; 93 background: #eee;
94 border: none; 94 border: none;
@@ -97,6 +97,7 @@ @@ -97,6 +97,7 @@
97 input::-webkit-input-placeholder { /* WebKit browsers */ 97 input::-webkit-input-placeholder { /* WebKit browsers */
98 text-align: center; 98 text-align: center;
99 } 99 }
  100 +
100 input:-ms-input-placeholder { /* Internet Explorer 10+ */ 101 input:-ms-input-placeholder { /* Internet Explorer 10+ */
101 text-align: center; 102 text-align: center;
102 } 103 }
@@ -107,7 +108,6 @@ @@ -107,7 +108,6 @@
107 margin-left: 30px; 108 margin-left: 30px;
108 109
109 .company-item { 110 .company-item {
110 -  
111 h2 { 111 h2 {
112 height: 50px; 112 height: 50px;
113 line-height: 50px; 113 line-height: 50px;
@@ -122,7 +122,7 @@ @@ -122,7 +122,7 @@
122 font-size: 30px; 122 font-size: 30px;
123 border-bottom: 1px solid #f3f3f3; 123 border-bottom: 1px solid #f3f3f3;
124 } 124 }
125 - } 125 + }
126 } 126 }
127 } 127 }
128 } 128 }
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 <br/> 14 <br/>
15 <div class="fav-price"> 15 <div class="fav-price">
16 <span class="new-price" v-if="item.discountPrice">{{item.discountPrice}}</span> 16 <span class="new-price" v-if="item.discountPrice">{{item.discountPrice}}</span>
17 - <span class="fav-price {{ item.discountPrice ? 'price-underline' : ''}}">{{item.price}}</span> 17 + <span class="{{ item.discountPrice ? 'price-underline' : ''}}">{{item.price}}</span>
18 </div> 18 </div>
19 <br/> 19 <br/>
20 <div class="save-price"> 20 <div class="save-price">