...
|
...
|
@@ -10,39 +10,45 @@ |
|
|
// 异步渲染的模板统一插入 #chose-panel ,兼容页面多个选择框
|
|
|
|
|
|
var $ = require('jquery'),
|
|
|
Handlebars = require('yoho.handlebars'),
|
|
|
tip = require('../plugin/tip'),
|
|
|
loading = require('../plugin/loading');
|
|
|
|
|
|
var panelTmpl,
|
|
|
$chosePanel = $('#chose-panel'),
|
|
|
var $chosePanel = $('#chose-panel'),
|
|
|
$num,
|
|
|
$chosed,
|
|
|
|
|
|
// panelTmpl,
|
|
|
// re = /\d+/,
|
|
|
leftNum,
|
|
|
confirming,
|
|
|
hasChooseColor = false,
|
|
|
hasChooseSize = false,
|
|
|
curColorIndex,
|
|
|
curSizeIndex,
|
|
|
$curSizeRow,
|
|
|
$curSizeBlock = null,
|
|
|
$sizeRowList = $('.size-list ul');
|
|
|
hasChooseColor,
|
|
|
hasChooseSize,
|
|
|
$curSizeBlock,
|
|
|
$sizeRowList;
|
|
|
|
|
|
// 读取模板
|
|
|
$.get('/cart/index/giftinfoTpl', function(html) {
|
|
|
if (!html) {
|
|
|
tip.show('网络错误');
|
|
|
return;
|
|
|
}
|
|
|
panelTmpl = Handlebars.compile(html);
|
|
|
}).fail(function() {
|
|
|
tip.show('网络错误');
|
|
|
});
|
|
|
// $.get('/cart/index/giftinfoTpl', function(html) {
|
|
|
// if (!html) {
|
|
|
// tip.show('网络错误');
|
|
|
// return;
|
|
|
// }
|
|
|
// panelTmpl = Handlebars.compile(html);
|
|
|
// }).fail(function() {
|
|
|
// tip.show('网络错误');
|
|
|
// });
|
|
|
|
|
|
//初始化购物车面板显示
|
|
|
function init() {
|
|
|
var $firstRow;
|
|
|
|
|
|
hasChooseColor = false;
|
|
|
hasChooseSize = false;
|
|
|
$curSizeBlock = null;
|
|
|
$sizeRowList = $('.size-list ul');
|
|
|
$firstRow = $sizeRowList.eq(0);
|
|
|
|
|
|
//$colorList = $('.chose-panel .color-list ul>li');
|
|
|
//$sizeList = $('.chose-panel .size-list ul>li');
|
...
|
...
|
@@ -55,11 +61,10 @@ function init() { |
|
|
// }
|
|
|
//});
|
|
|
|
|
|
var $firstRow = $sizeRowList.eq(0);
|
|
|
|
|
|
$firstRow.toggleClass('hide');
|
|
|
$curSizeRow = $firstRow;
|
|
|
}
|
|
|
init();
|
|
|
|
|
|
function checkColorSizeNum() {
|
|
|
if (!hasChooseColor && !hasChooseSize) {
|
...
|
...
|
@@ -75,11 +80,9 @@ function checkColorSizeNum() { |
|
|
return true;
|
|
|
}
|
|
|
|
|
|
init();
|
|
|
|
|
|
function show(data) {
|
|
|
if (data) {
|
|
|
$chosePanel.html(panelTmpl(data));
|
|
|
function show(html) {
|
|
|
if (html) {
|
|
|
$chosePanel.html(html);
|
|
|
init();
|
|
|
}
|
|
|
$('.chose-panel').show();
|
...
|
...
|
|