Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-portal-fe
·
Commits
Go to a project
GitLab
Go to group
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
Plain Diff
Browse Files
Authored by
王钱钧
9 years ago
Commit
5ee2341963fb73dd11e9e8b6bec0bdc4949787e1
2 parents
2a15885d
5374c9e0
Merge branch 'develop' of
http://git.dev.yoho.cn/platform/yohobuy-portal-fe
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
94 additions
and
48 deletions
client/js/common/edit.js
client/js/common/upload.js
client/js/common/validate.js
client/js/goods/index.js
client/js/index.js
client/js/market/coupon-edit.js
server/interface/goods.js
server/views/pages/goods/index.html
server/views/pages/market/coupon-edit.html
client/js/common/edit.js
View file @
5ee2341
...
...
@@ -18,7 +18,7 @@ $("button").click(function(){
})*/
var
$
=
require
(
'jquery'
);
var
Validator
=
require
(
'.
./util
/validate'
);
var
Validator
=
require
(
'./validate'
);
require
(
'./upload'
);
require
(
'../util/datepicker'
);
require
(
'../util/jquery.gritter'
);
...
...
@@ -200,6 +200,8 @@ edit.prototype={
var
that
=
this
;
var
rules
=
{},
data
=
{},
attributes
=
{};
var
err
=
[];
$
(
"input:text"
,
that
.
el
)
.
add
(
"input[type=number]"
,
that
.
el
)
.
add
(
"input[type=file]"
,
that
.
el
)
...
...
@@ -212,14 +214,16 @@ edit.prototype={
value
=!!
$
(
this
).
attr
(
"value"
)?
$
(
this
).
attr
(
"value"
):
$
(
this
).
val
();
}
var
name
=
$
(
this
).
attr
(
"placeholder"
)
&&!
(
/^
\d
+$/
.
test
(
$
(
this
).
attr
(
"placeholder"
)))?
$
(
this
).
attr
(
"placeholder"
).
replace
(
/请填写/g
,
''
):
$
(
this
).
parents
(
".form-group"
).
find
(
"label"
).
text
().
replace
(
/
\*
/g
,
''
);
var
rule
=
[];
//
var rule = [];
if
(
$
(
this
).
attr
(
"required"
))
{
rule
.
push
(
"required"
);
rules
[
id
]
=
rule
.
join
(
'|'
);
data
[
id
]
=
value
;
attributes
[
id
]
=
name
;
new
Validator
.
init
(
document
.
getElementById
(
id
),{
rules
:{
required
:
true
}
}).
validate
(
function
(
obj
){
err
.
push
(
"<p>"
+
name
+
"不可为空</p>"
);
});
}
// if ($(this).attr("maxlength")) {
// rule.push("max:" + $(this).attr("maxlength"));
// }
...
...
@@ -238,13 +242,17 @@ edit.prototype={
});
var
v
=
Validator
.
make
(
data
,
rules
);
v
.
mergeAttribute
(
attributes
);
var
err
=
[];
if
(
v
.
fails
())
{
for
(
var
key
in
v
.
messages
()){
err
.
push
(
"<p>"
+
v
.
messages
()[
key
]
+
"</p>"
);
}
// var v = Validator.make(data, rules);
// v.mergeAttribute(attributes);
// var err=[];
// if (v.fails()) {
// for(var key in v.messages()){
// err.push("<p>"+v.messages()[key]+"</p>");
// }
// that.__err(err.join(''));
// return false;
// }
if
(
err
.
length
>
0
){
that
.
__err
(
err
.
join
(
''
));
return
false
;
}
...
...
@@ -335,7 +343,8 @@ edit.ajaxfileupload=function(el,option){
'action'
:
'/ajax/upload'
,
'params'
:
$
.
extend
({},{
__type
:
"fileupload-upload"
},
option
.
params
),
onComplete
:
option
.
onComplete
,
onStart
:
option
.
onStart
onStart
:
option
.
onStart
,
valid_extensions
:[
"xlsx"
]
})
}
edit
.
prototype
.
init
.
prototype
=
edit
.
prototype
;
...
...
client/js/common/upload.js
View file @
5ee2341
...
...
@@ -10,7 +10,7 @@ $.fn.ajaxfileupload = function(options) {
onComplete
:
function
(
response
)
{
},
onCancel
:
function
()
{
},
validate_extensions
:
true
,
valid_extensions
:
[
'gif'
,
'png'
,
'jpg'
,
'jpeg'
,
'xlsx'
],
valid_extensions
:
[
'gif'
,
'png'
,
'jpg'
,
'jpeg'
],
submit_button
:
null
};
...
...
@@ -54,7 +54,7 @@ $.fn.ajaxfileupload = function(options) {
var
ext
=
$element
.
val
().
split
(
'.'
).
pop
().
toLowerCase
();
if
(
true
===
settings
.
validate_extensions
&&
$
.
inArray
(
ext
,
settings
.
valid_extensions
)
==
-
1
)
{
settings
.
onComplete
.
apply
(
$element
,
[{
status
:
false
,
message
:
'
The select file type is invalid. File must be '
+
settings
.
valid_extensions
.
join
(
', '
)
+
'.'
},
settings
.
params
]);
settings
.
onComplete
.
apply
(
$element
,
[{
status
:
false
,
message
:
'
文件类型无效.只支持'
+
settings
.
valid_extensions
.
join
(
','
)
},
settings
.
params
]);
}
else
{
uploading_file
=
true
;
...
...
@@ -78,7 +78,13 @@ $.fn.ajaxfileupload = function(options) {
element
.
unwrap
();
uploading_file
=
false
;
settings
.
onComplete
.
apply
(
element
,
[
response
,
settings
.
params
]);
var
_$element
=
$element
.
clone
();
var
_$parent
=
$element
.
parent
();
$element
.
remove
();
_$parent
.
append
(
_$element
);
_$element
.
ajaxfileupload
(
settings
);
};
var
wrapElement
=
function
(
element
)
{
var
frame_id
=
'ajaxUploader-iframe-'
+
Math
.
round
(
new
Date
().
getTime
()
/
1000
)
...
...
client/js/common/validate.js
View file @
5ee2341
...
...
@@ -42,14 +42,14 @@ var Validate = function(element, options) {
var
defaults
=
{
regExps
:
regExps
,
messages
:
messages
messages
:
"messages"
};
this
.
options
=
_extend
({},
defaults
,
options
);
this
.
element
=
element
;
this
.
regExps
=
regExps
;
};
var
fn
=
Validate
.
prototype
;
fn
.
validate
=
function
()
{
fn
.
validate
=
function
(
onError
)
{
var
isValid
=
true
;
this
.
value
=
this
.
element
.
value
;
for
(
var
rule
in
this
.
options
.
rules
)
{
...
...
@@ -62,7 +62,7 @@ fn.validate = function() {
if
(
!
this
[
rule
](
param
))
{
isValid
=
false
;
this
.
message
=
"Error"
//_createMessage(this.options.messages[rule], {rule: param, data: this.value});
this
.
options
.
onError
.
call
(
this
);
onError
&&
onError
.
call
(
null
,
this
);
break
;
}
}
...
...
client/js/goods/index.js
View file @
5ee2341
...
...
@@ -11,15 +11,15 @@ var ENUM={
new
common
.
dropDown
({
el
:
'#shop'
,
ajax
:
'
queryShop
'
ajax
:
'
shopsRest
'
});
new
common
.
dropDown
({
el
:
'#supplier'
,
ajax
:
'
queryS
upplier'
ajax
:
'
s
upplier'
});
new
common
.
dropDown
({
el
:
'#brand'
,
ajax
:
'
queryB
rand'
ajax
:
'
b
rand'
});
new
common
.
dropDown
({
el
:
'#cate'
,
...
...
@@ -61,9 +61,9 @@ var g = new common.grid({
return
ENUM
.
vipType
[
item
.
vip_discount_type
];
}},
{
display
:
'VIP价'
,
name
:
'vip_price'
},
{
display
:
'自定义白金'
,
name
:
'vip3_price'
},
{
display
:
'自定义金卡'
,
name
:
'vip2_price'
},
{
display
:
'自定义银卡'
,
name
:
'vip1_price'
},
{
display
:
'白金'
,
name
:
'vip3_price'
},
{
display
:
'金卡'
,
name
:
'vip2_price'
},
{
display
:
'银卡'
,
name
:
'vip1_price'
},
{
display
:
'返币金额'
,
name
:
'return_coin'
},
{
display
:
'操作信息'
,
name
:
'operateInfo'
,
render
:
function
(
item
)
{
var
html
=
''
;
...
...
@@ -264,7 +264,11 @@ var p = new common.grid({
'<p style="color: #ccc;">'
+
ENUM
.
vipType
[
item
.
oldProductPriceBo
.
vip_discount_type
]
+
'</p>'
;
}},
{
display
:
'VIP价'
,
render
:
function
(
item
)
{
return
item
.
newProductPriceBo
.
vip_price
+
'<p style="color: #ccc;">'
+
item
.
oldProductPriceBo
.
vip_price
+
'</p>'
;
var
newPrice
=
'-'
;
if
(
item
.
newProductPriceBo
.
vip_price
)
{
newPrice
=
item
.
newProductPriceBo
.
vip_price
;
}
return
newPrice
+
'<p style="color: #ccc;">'
+
item
.
oldProductPriceBo
.
vip_price
+
'</p>'
;
}},
{
display
:
'白金价'
,
render
:
function
(
item
)
{
return
item
.
newProductPriceBo
.
vip3_price
+
'<p style="color: #ccc;">'
+
item
.
oldProductPriceBo
.
vip3_price
+
'</p>'
;
...
...
@@ -305,12 +309,17 @@ $('#sure-change').on('click', function() {
var
arr
=
[],
data
=
''
;
if
(
!
successList
||
successList
.
length
==
0
)
{
alert
(
'请上传批量变价文件'
);
return
;
}
$
.
each
(
successList
,
function
(
i
,
value
)
{
arr
.
push
(
value
.
newProductPriceBo
);
});
/*var data = arr.join('');*/
data
=
JSON
.
stringify
(
arr
);
console
.
log
(
data
);
common
.
util
.
__ajax
({
url
:
'/goods/batchUpdatePrice'
,
data
:{
...
...
client/js/index.js
View file @
5ee2341
...
...
@@ -34,7 +34,7 @@ $('.leftpanel .nav .parent>a').click(function() {
$
(
".leftpanel .nav .children a"
).
each
(
function
(){
var
attr
=
$
(
this
).
attr
(
"href"
);
if
(
attr
==
window
.
location
.
pathname
){
if
(
attr
==
window
.
location
.
pathname
+
window
.
location
.
search
){
$
(
this
).
parents
(
".children"
).
show
();
$
(
this
).
parent
(
"li"
).
addClass
(
"active"
);
$
(
this
).
parents
(
".parent"
).
addClass
(
"parent-focus"
);
...
...
client/js/market/coupon-edit.js
View file @
5ee2341
...
...
@@ -20,14 +20,18 @@ var edit=require('../common/edit');
if
(
$
(
"#promotionInfo"
).
val
()){
var
__promotionInfo
=
JSON
.
parse
(
$
(
"#promotionInfo"
).
val
());
$
(
"#promotionInfo-type"
).
val
(
__promotionInfo
[
"type"
]);
$
(
"input:radio[name=promotionInfo-type]"
).
each
(
function
(){
if
(
$
(
this
).
val
()
==
__promotionInfo
[
"type"
]){
$
(
this
).
prop
(
"checked"
,
"checked"
);
if
(
$
(
this
).
val
()
==
"3"
){
$
(
"#resultdiscount"
).
hide
();
}
}
});
$
(
"#promotionInfo-condition-amount_at_least"
).
val
(
__promotionInfo
[
"condition"
][
"amount_at_least"
]);
$
(
"#promotionInfo-condition-count_at_least"
).
val
(
__promotionInfo
[
"condition"
][
"count_at_least"
]);
$
(
"#promotionInfo-action-discount"
).
val
(
__promotionInfo
[
"action"
][
"discount"
]);
$
(
"#promotionInfo-action-discount_at_most"
).
val
(
__promotionInfo
[
"action"
][
"discount_at_most"
]);
if
(
$
(
"#promotionInfo-type"
).
val
()
==
"3"
)
{
$
(
"#resultdiscount"
).
hide
();
}
}
});
...
...
@@ -74,12 +78,10 @@ var edit=require('../common/edit');
$discount
=
$
(
"#promotionInfo-action-discount"
);
$
(
"input:radio[name=promotionInfo-type]"
).
change
(
function
(){
var
$checked
=
$
(
this
);
if
(
$checked
.
prop
(
"name"
)
==
"promotionInfo-type"
)
{
if
(
$checked
.
val
()
==
"3"
)
{
$discount
.
prop
(
"disabled"
,
true
).
val
(
"0.00"
).
parents
(
"#resultdiscount"
).
hide
();
}
else
{
$discount
.
prop
(
"disabled"
,
false
).
parents
(
"#resultdiscount"
).
show
();
}
if
(
$checked
.
val
()
==
"3"
)
{
$discount
.
prop
(
"disabled"
,
true
).
val
(
"0.00"
).
parent
(
"#resultdiscount"
).
hide
();
}
else
{
$discount
.
prop
(
"disabled"
,
false
).
parent
(
"#resultdiscount"
).
show
();
}
});
});
...
...
server/interface/goods.js
View file @
5ee2341
exports
.
domain
=
require
(
'../config/common.js'
).
domain
;
//exports.domain = 'http://172.16.6.227:8083/yohobuy-platform-web'; //变价
//exports.domain = require('../config/common.js').domain;
exports
.
domain
=
'http://172.16.6.227:8083/yohobuy-platform-web'
;
//变价
//exports.domain = 'http://172.16.6.162:8088/platform'; //品牌合作
//商品管理路由配置
...
...
@@ -95,25 +95,45 @@ exports.res = [
route
:
'/goods/query/shop'
,
method
:
'POST'
,
url
:
'/ShopsRest/queryAllShops'
,
params
:
[]
params
:
[
{
name
:
'idName'
,
type
:
'String'
}
]
},
{
//查询品牌列表接口
route
:
'/goods/query/brand'
,
method
:
'POST'
,
url
:
'/erpproduct/brands/queryAllBrands'
,
params
:
[]
params
:
[
{
name
:
'idName'
,
type
:
'String'
}
]
},
{
//查询供应商列表接口
route
:
'/goods/query/supplier'
,
method
:
'POST'
,
url
:
'/supplier/supplier/queryAllSupplier'
,
params
:
[]
params
:
[
{
name
:
'idName'
,
type
:
'String'
}
]
},
{
//查询一级类目列表接口
route
:
'/goods/query/maxSort'
,
method
:
'POST'
,
url
:
'/product/queryAllMaxSortList'
,
params
:
[]
url
:
'/product/queryMaxSortByName'
,
params
:
[
{
name
:
'idName'
,
type
:
'String'
}
]
},
{
//单个变价接口
route
:
'/goods/updatePrice'
,
...
...
server/views/pages/goods/index.html
View file @
5ee2341
...
...
@@ -149,7 +149,7 @@
</div>
{{/ brandCooperationSet}}
<a
id=
"filter-btn"
href=
"javascript:;"
class=
"btn btn-info"
>
筛选
</a>
<a
id=
"all-btn"
href=
"
javascript:;
"
class=
"btn btn-info"
>
全部
</a>
<a
id=
"all-btn"
href=
""
class=
"btn btn-info"
>
全部
</a>
</div>
{{/ filter}}
...
...
server/views/pages/market/coupon-edit.html
View file @
5ee2341
...
...
@@ -100,7 +100,7 @@
<input
type=
"radio"
value=
"3"
name=
"promotionInfo-type"
>
满减
</label>
</div>
<!--
<input type="hidden" value="1" id="promotionInfo-type"> -->
<!--
<input type="hidden" value="1" id="promotionInfo-type"> -->
<!-- required checked-->
</div>
...
...
Please
register
or
login
to post a comment