...
|
...
|
@@ -10,50 +10,37 @@ |
|
|
// 异步渲染的模板统一插入 #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,
|
|
|
|
|
|
// re = /\d+/,
|
|
|
leftNum,
|
|
|
confirming,
|
|
|
hasChooseColor,
|
|
|
hasChooseSize,
|
|
|
curColorIndex,
|
|
|
curSizeIndex,
|
|
|
$curSizeRow,
|
|
|
hasChooseColor,
|
|
|
hasChooseSize,
|
|
|
$curSizeBlock,
|
|
|
$sizeRowList;
|
|
|
|
|
|
// 读取模板
|
|
|
$.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);
|
|
|
$curSizeBlock = null,
|
|
|
|
|
|
hasChooseSize = false,
|
|
|
hasChooseColor = false,
|
|
|
$firstRow.toggleClass('hide');
|
|
|
$curSizeRow = $firstRow;
|
|
|
}
|
|
|
init();
|
|
|
|
|
|
function checkColorSizeNum() {
|
|
|
if (!hasChooseColor && !hasChooseSize) {
|
...
|
...
|
@@ -69,9 +56,9 @@ function checkColorSizeNum() { |
|
|
return true;
|
|
|
}
|
|
|
|
|
|
function show(data) {
|
|
|
if (data) {
|
|
|
$chosePanel.html(panelTmpl(data));
|
|
|
function show(html) {
|
|
|
if (html) {
|
|
|
$chosePanel.html(html);
|
|
|
init();
|
|
|
}
|
|
|
$('.chose-panel').show();
|
...
|
...
|
|