Toggle navigation
Toggle navigation
This project
Loading...
Sign in
liuloulou
/
yohobuy-portal-fe2
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
姜敏
9 years ago
Commit
228f4bd8127454d501d0ee898e588788d399294b
1 parent
9fdbd27e
修复尺码测量搜索后多表的bug
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
63 deletions
code/static/js.jquery/common/sizeInfo.js
code/static/js.jquery/module/shootMeter/MeterSize/Add.js
code/static/js.jquery/common/sizeInfo.js
View file @
228f4bd
...
...
@@ -4,12 +4,12 @@ var $ = require('jquery'),
util
=
require
(
"./util"
),
grid
=
require
(
'./grid'
);
var
headList
=
[];
/**
* 界面列表显示
* @param data
*/
var
list
=
function
(
data
)
{
var
headList
=
[];
var
a
=
data
.
productType
.
replace
(
/<br>/g
,
"/"
);
data
.
productType
=
a
.
substring
(
0
,
a
.
length
-
1
);
var
j
=
0
;
//创造一个变量以供赋值
...
...
code/static/js.jquery/module/shootMeter/MeterSize/Add.js
View file @
228f4bd
...
...
@@ -5,78 +5,87 @@ var $ = require('jquery');
var
common
=
require
(
'../../../common/common'
);
var
hasClickEvent
=
false
;
//判断保存按钮是否有点击事件;
var
flag
=
false
;
//判断搜索按钮是否点击
var
val
=
""
;
//保存输入框旧值
//定义全局数据变量
var
dataList
=
{};
//点击搜索按钮
$
(
document
).
on
(
'click'
,
'#searchSku'
,
function
()
{
var
val
=
$
.
trim
(
$
(
"#skuInput"
).
val
());
if
(
!
val
.
match
(
/^
[
0-9
]
+$/
))
{
common
.
util
.
__tip
(
"输入不合法"
,
"warning"
);
return
;
var
newVal
=
$
.
trim
(
$
(
"#skuInput"
).
val
());
//输入框当前值
if
(
newVal
!==
val
)
{
flag
=
false
;
}
if
(
val
)
{
$
(
"#add-list"
).
hide
();
common
.
util
.
__ajax
({
url
:
'/meterManage/productSize/queryProdSizeList'
,
data
:
{
productSku
:
val
}
},
function
(
res
)
{
if
(
res
.
data
.
list
&&
res
.
data
.
list
.
length
>
0
)
{
var
e
=
new
common
.
edit
(
"#add-list"
);
dataList
=
res
.
data
.
list
[
0
];
common
.
sizeInfo
.
list
(
dataList
);
$
(
"#add-head"
).
html
(
common
.
util
.
__template2
(
$
(
"#modifySize-template"
).
html
(),
dataList
));
$
(
"#noMeasureIds"
).
val
(
dataList
.
noMeasureIds
?
dataList
.
noMeasureIds
.
join
(
"|"
)
:
""
);
$
(
"#add-list"
).
show
();
e
.
init
();
if
(
!
hasClickEvent
)
{
hasClickEvent
=
true
;
$
(
document
).
on
(
'click'
,
'#add-saveBtn'
,
function
()
{
var
noMeasureIds
=
JSON
.
stringify
(
$
(
"#noMeasureIds"
).
val
()
?
$
(
"#noMeasureIds"
).
val
().
split
(
"|"
)
:
[]);
//无需测量的列
//尺码信息列表
var
sizeInfoList
=
[];
for
(
var
i
=
0
;
i
<
$
(
".sizeInfo"
).
length
;
i
++
)
{
var
info
=
$
(
$
(
".sizeInfo"
)[
i
]);
//当前尺码input对象
var
prdList
=
dataList
.
sizeRelationsList
[
info
.
data
(
"index"
)].
prdSizeAttributeBoList
;
//当前列的对象的尺码列表
var
attrIndex
=
parseInt
(
i
%
prdList
.
length
);
//在当前列的索引
sizeInfoList
[
i
]
=
({
if
(
flag
==
false
)
{
val
=
$
.
trim
(
$
(
"#skuInput"
).
val
());
if
(
!
val
.
match
(
/^
[
0-9
]
+$/
))
{
common
.
util
.
__tip
(
"输入不合法"
,
"warning"
);
return
;
}
if
(
val
)
{
$
(
"#add-list"
).
hide
();
common
.
util
.
__ajax
({
url
:
'/meterManage/productSize/queryProdSizeList'
,
data
:
{
productSku
:
val
}
},
function
(
res
)
{
if
(
res
.
data
.
list
&&
res
.
data
.
list
.
length
>
0
)
{
flag
=
true
;
var
e
=
new
common
.
edit
(
"#add-list"
);
dataList
=
res
.
data
.
list
[
0
];
common
.
sizeInfo
.
list
(
dataList
);
$
(
"#add-head"
).
html
(
common
.
util
.
__template2
(
$
(
"#modifySize-template"
).
html
(),
dataList
));
$
(
"#noMeasureIds"
).
val
(
dataList
.
noMeasureIds
?
dataList
.
noMeasureIds
.
join
(
"|"
)
:
""
);
$
(
"#add-list"
).
show
();
e
.
init
();
if
(
!
hasClickEvent
)
{
hasClickEvent
=
true
;
$
(
document
).
on
(
'click'
,
'#add-saveBtn'
,
function
()
{
var
noMeasureIds
=
JSON
.
stringify
(
$
(
"#noMeasureIds"
).
val
()
?
$
(
"#noMeasureIds"
).
val
().
split
(
"|"
)
:
[]);
//无需测量的列
//尺码信息列表
var
sizeInfoList
=
[];
for
(
var
i
=
0
;
i
<
$
(
".sizeInfo"
).
length
;
i
++
)
{
var
info
=
$
(
$
(
".sizeInfo"
)[
i
]);
//当前尺码input对象
var
prdList
=
dataList
.
sizeRelationsList
[
info
.
data
(
"index"
)].
prdSizeAttributeBoList
;
//当前列的对象的尺码列表
var
attrIndex
=
parseInt
(
i
%
prdList
.
length
);
//在当前列的索引
sizeInfoList
[
i
]
=
({
productSkn
:
dataList
.
productSkn
,
sizeId
:
dataList
.
sizeRelationsList
[
info
.
data
(
"index"
)].
sizeId
,
sizeAttributeId
:
prdList
[
attrIndex
].
sizeAttributeId
,
sizeValue
:
info
.
val
()
});
}
//商品参考尺码
var
productSizeReferList
=
[];
for
(
var
i
=
0
;
i
<
$
(
".refInfo"
).
length
/
2
;
i
++
)
{
var
ref1
=
$
(
$
(
".refInfo1"
)[
i
]);
var
ref2
=
$
(
$
(
".refInfo2"
)[
i
]);
productSizeReferList
.
push
({
sizeId
:
dataList
.
sizeRelationsList
[
ref1
.
data
(
"index"
)].
sizeId
,
gender
:
dataList
.
gender
,
referenceName
:
ref1
.
val
()
+
'/'
+
ref2
.
val
()
});
}
var
data
=
{
productSkn
:
dataList
.
productSkn
,
sizeId
:
dataList
.
sizeRelationsList
[
info
.
data
(
"index"
)].
sizeId
,
sizeAttributeId
:
prdList
[
attrIndex
].
sizeAttributeId
,
sizeValue
:
info
.
val
()
noMeasureIds
:
noMeasureIds
,
sizeInfoList
:
JSON
.
stringify
(
sizeInfoList
),
productSizeReferList
:
JSON
.
stringify
(
productSizeReferList
)
};
common
.
util
.
__ajax
({
url
:
"/meterManage/productSize/saveProdSizeInfo"
,
data
:
data
},
function
()
{
});
}
//商品参考尺码
var
productSizeReferList
=
[];
for
(
var
i
=
0
;
i
<
$
(
".refInfo"
).
length
/
2
;
i
++
)
{
var
ref1
=
$
(
$
(
".refInfo1"
)[
i
]);
var
ref2
=
$
(
$
(
".refInfo2"
)[
i
]);
productSizeReferList
.
push
({
sizeId
:
dataList
.
sizeRelationsList
[
ref1
.
data
(
"index"
)].
sizeId
,
gender
:
dataList
.
gender
,
referenceName
:
ref1
.
val
()
+
'/'
+
ref2
.
val
()
});
}
var
data
=
{
productSkn
:
dataList
.
productSkn
,
noMeasureIds
:
noMeasureIds
,
sizeInfoList
:
JSON
.
stringify
(
sizeInfoList
),
productSizeReferList
:
JSON
.
stringify
(
productSizeReferList
)
};
common
.
util
.
__ajax
({
url
:
"/meterManage/productSize/saveProdSizeInfo"
,
data
:
data
},
function
()
{
return
false
;
});
return
false
;
});
}
}
else
{
common
.
util
.
__tip
(
"未搜索到sku:"
+
val
);
}
}
else
{
common
.
util
.
__tip
(
"未搜索到sku:"
+
val
);
}
},
true
);
},
true
);
}
}
});
//enter键触发搜索按钮
$
(
"#skuInput"
).
keydown
(
function
()
{
if
(
event
.
keyCode
==
"13"
)
{
$
(
"#searchSku"
).
click
();
...
...
@@ -84,4 +93,4 @@ $("#skuInput").keydown(function () {
});
//当点击“无需测量”,该列输入框不可编辑
common
.
sizeInfo
.
check
();
\ No newline at end of file
common
.
sizeInfo
.
check
();
...
...
Please
register
or
login
to post a comment