Authored by 周少峰

Merge branch 'hotfix/productMaterial' into gray

... ... @@ -36,9 +36,9 @@
</div>
<div class="line">
<label for="">品类:</label>
<select name="" id="category-1" class="sel"></select>
<select name="" id="category-2" class="sel"></select>
<select name="" id="category-3" class="sel"></select>
<select name="" id="category-1" class="sel"><option value="">--请选择--</option></select>
<select name="" id="category-2" class="sel"><option value="">--请选择--</option></select>
<select name="" id="category-3" class="sel"><option value="">--请选择--</option></select>
<div class="search-recommend-btn">自动推荐</div>
<div class="search-btn">搜索</div>
</div>
... ...
... ... @@ -11,8 +11,8 @@
{{#each product_list}}
<tr>
<td>{{productSkn}}</td>
<td><a href="/p{{productId}}.html" target="_blank">{{productName}}</a></td>
<td><a href="/p{{productId}}.html" target="_blank"><img src="{{picImgUrl}}" alt=""></a></td>
<td><a href="//item.yohobuy.com/p{{productId}}.html" target="_blank">{{productName}}</a></td>
<td><a href="//item.yohobuy.com/p{{productId}}.html" target="_blank"><img src="{{picImgUrl}}" alt=""></a></td>
<td>{{standardVal}}</td>
<td>{{style}}</td>
<td>{{pattern}}</td>
... ...
... ... @@ -11,8 +11,8 @@
{{#each product_list}}
<tr>
<td>{{productSkn}}</td>
<td><a href="/p{{productId}}.html" target="_blank">{{productName}}</a></td>
<td><a href="/p{{productId}}.html" target="_blank"><img src="{{picImgUrl}}" alt=""></a></td>
<td><a href="//item.yohobuy.com/p{{productId}}.html" target="_blank">{{productName}}</a></td>
<td><a href="//item.yohobuy.com/p{{productId}}.html" target="_blank"><img src="{{picImgUrl}}" alt=""></a></td>
<td>{{standardVal}}</td>
<td>{{style}}</td>
<td>{{pattern}}</td>
... ...

6.57 KB | W: | H:

7.35 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
var $ = require('yoho-jquery');
var _ = require('lodash');
var brandTmp = require('hbs/material/brand.hbs');
var tableTmp = require('hbs/material/tbl.hbs');
var $mask = $('.mask');
var $brand = $('#brand_container');
var query = {
page: 1,
maxSortId: 0,
middleSortId: 0,
smallSortId: 0
maxSortId: '',
middleSortId: '',
smallSortId: ''
};
var brandList = {
list1: [],
... ... @@ -16,6 +15,7 @@ var brandList = {
list3: [],
list4: []
};
var option0 = '<option value="">--请选择--</option>';
function brandItemEventBind() {
$('#brand_container .item').off().on('click', function() {
... ... @@ -45,7 +45,7 @@ function getBrandList(_index, yhChannel) {
}
function getCategoryOpt(opts) {
var html = '';
var html = option0;
$.each(opts, function(k, c) {
html += '<option value="' + c.sort_id + '">' + c.sort_name + '</option>';
... ... @@ -54,6 +54,18 @@ function getCategoryOpt(opts) {
return html;
}
function findSub(data, id) {
var sub = [];
$.each(data, function(k, c) {
if (c.sort_id === id) {
sub = c.sub;
}
});
return sub;
}
getBrandList(1, 1);
/* 获取品类数据*/
... ... @@ -72,21 +84,34 @@ $.get('/3party/material/getCategory', function(res) {
$category1.on('change', function() {
var id = $(this).val();
var html = option0;
sub = _.find(categoryData, {sort_id: id}).sub;
$category2.html(getCategoryOpt(sub)).show();
$category3.html('').hide();
query.maxSortId = id;
query.middleSortId = $category2.find('option').eq(0).attr('value');
query.maxSortId = '';
query.middleSortId = '';
query.smallSortId = '';
if ($(this).find('option:selected').index() !== 0) {
sub = findSub(categoryData, id);
html = getCategoryOpt(sub);
query.maxSortId = id;
}
$category2.html(html);
$category3.html(option0);
});
$category2.on('change', function() {
var id = $(this).val();
var third = _.find(sub, {sort_id: id}).sub;
var third = [];
$category3.html(getCategoryOpt(third)).show();
query.middleSortId = id;
query.smallSortId = $category3.find('option').eq(0).attr('value');
query.smallSortId = '';
query.middleSortId = '';
if ($(this).find('option:selected').index() !== 0) {
third = findSub(sub, id);
$category3.html(getCategoryOpt(third));
query.middleSortId = id;
}
});
$category3.on('change', function() {
... ...
... ... @@ -133,14 +133,6 @@
}
}
#category-2 {
display: none;
}
#category-3 {
display: none;
}
.search-btn {
float: right;
border-radius: 4px;
... ...