Authored by 郭成尧

new-product

@@ -22,15 +22,15 @@ @@ -22,15 +22,15 @@
22 <div class="tab"> 22 <div class="tab">
23 <ul class="shop-tabs tab-navs" data-sticky> 23 <ul class="shop-tabs tab-navs" data-sticky>
24 <li class="shop-tab-nav tab-nav active"> 24 <li class="shop-tab-nav tab-nav active">
25 - <span data-target="#red-index" data-trigger="tab" data-funFilterHide>首页</span> 25 + <span data-target="#red-index" data-trigger="tab" data-funHome>首页</span>
26 </li> 26 </li>
27 <em>|</em> 27 <em>|</em>
28 <li class="shop-tab-nav tab-nav"> 28 <li class="shop-tab-nav tab-nav">
29 - <span data-target="#red-new" data-trigger="tab" data-funFilterHide data-funGetNewGoods>上新</span> 29 + <span data-target="#all-goods" data-trigger="tab" data-funGetNewGoods>上新</span>
30 </li> 30 </li>
31 <em>|</em> 31 <em>|</em>
32 <li class="shop-tab-nav tab-nav"> 32 <li class="shop-tab-nav tab-nav">
33 - <span data-target="#all-goods" data-trigger="tab" data-funFilterShow>全部商品</span> 33 + <span data-target="#all-goods" data-trigger="tab" data-funGetAllGoods>全部商品</span>
34 </li> 34 </li>
35 </ul> 35 </ul>
36 {{!--筛选tab--}} 36 {{!--筛选tab--}}
@@ -44,12 +44,6 @@ @@ -44,12 +44,6 @@
44 <div class="shop-coupon coupon-group"></div> 44 <div class="shop-coupon coupon-group"></div>
45 {{> reds-shop/modules}} 45 {{> reds-shop/modules}}
46 </div> 46 </div>
47 - {{!--shop-tab: 上新--}}  
48 - <div id="red-new">  
49 - <div class="new-good-list-page yoho-page">  
50 -  
51 - </div>  
52 - </div>  
53 {{!--shop-tab: 全部商品--}} 47 {{!--shop-tab: 全部商品--}}
54 <div id="all-goods" class="tab-panel"> 48 <div id="all-goods" class="tab-panel">
55 <div class="good-list-page yoho-page"> 49 <div class="good-list-page yoho-page">
@@ -4,23 +4,20 @@ require('product/shop/redshop.page.css'); @@ -4,23 +4,20 @@ require('product/shop/redshop.page.css');
4 4
5 const $ = require('yoho-jquery'); 5 const $ = require('yoho-jquery');
6 const allProduct = require('./shop/all-product'); 6 const allProduct = require('./shop/all-product');
7 -const newProuct = require('./shop/new-product');  
8 let Tab = require('../plugin/tab'); 7 let Tab = require('../plugin/tab');
9 8
10 let $filterBox = $('.filter-box'); 9 let $filterBox = $('.filter-box');
11 -let $goodsContainer = $('#goods-container');  
12 10
13 -Tab.prototype.filterhide = function() { // 隐藏筛选 TAB 11 +Tab.prototype.home = function() { // 隐藏筛选 TAB
14 $filterBox.css('display', 'none'); 12 $filterBox.css('display', 'none');
15 }; 13 };
16 -Tab.prototype.filtershow = function() { // 显示筛选 TAB 14 +Tab.prototype.getallgoods = function() { // 显示筛选 TAB
17 $filterBox.css('display', 'block'); 15 $filterBox.css('display', 'block');
18 - if ($goodsContainer.find('.good-info').length < 1) {  
19 - allProduct.getGoodsList();  
20 - } 16 + allProduct.getGoodsList({type: 'default', page: 0});
21 }; 17 };
22 Tab.prototype.getnewgoods = function() { 18 Tab.prototype.getnewgoods = function() {
23 - newProuct.getNewGoods(); 19 + $filterBox.css('display', 'none');
  20 + allProduct.getGoodsList({type: 'new', page: 0});
24 }; 21 };
25 22
26 // 页面打开直接加载筛选项 23 // 页面打开直接加载筛选项
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-03-24 13:43:55 3 * @Date: 2017-03-24 13:43:55
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-03-24 17:57:30 5 + * @Last Modified time: 2017-03-31 10:38:43
6 */ 6 */
7 7
8 /** ***************************** 8 /** *****************************
@@ -70,7 +70,7 @@ const handleChoseFilter = function() { @@ -70,7 +70,7 @@ const handleChoseFilter = function() {
70 /** 70 /**
71 * 获取商品列表 71 * 获取商品列表
72 */ 72 */
73 -const getGoodsList = function() { 73 +const getGoodsList = params => {
74 handleChoseFilter(); 74 handleChoseFilter();
75 75
76 if (!onSearching) { 76 if (!onSearching) {
@@ -79,6 +79,11 @@ const getGoodsList = function() { @@ -79,6 +79,11 @@ const getGoodsList = function() {
79 }); 79 });
80 } 80 }
81 81
  82 + // 有参数,参数优先
  83 + if (params) {
  84 + Object.assign(defaultOpt, params);
  85 + }
  86 +
82 if (nav && nav.end) { 87 if (nav && nav.end) {
83 return false; 88 return false;
84 } 89 }
1 -/*  
2 - * @Author: Targaryen  
3 - * @Date: 2017-03-30 16:03:01  
4 - * @Last Modified by: Targaryen  
5 - * @Last Modified time: 2017-03-30 16:03:55  
6 - */  
7 -  
8 -/* **************************  
9 - * 红人店铺-上新  
10 - ************************** */  
11 -  
12 -const getNewGoods = () => {  
13 - console.log('ok');  
14 -};  
15 -  
16 -  
17 -module.exports = {  
18 - getNewGoods  
19 -};