Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-portal-fe2
·
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
Email Patches
Plain Diff
Browse Files
Authored by
wangwei
8 years ago
Commit
9c8cb7ccc484bf6166085ec36e3fc20adce4764d
1 parent
7a9650fa
促销多档
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
301 additions
and
3 deletions
code/apps/customService/controllers/promotion.js
code/apps/customService/interfaces/promotion.js
code/apps/customService/views/promotion/Edit.html
code/apps/customService/views/promotion/LogIndex.html
code/apps/customService/views/promotion/__fragement/multi.html
code/static/js.jquery/module/customService/promotion/Edit.js
code/static/js.jquery/module/customService/promotion/LogIndex.js
code/static/js.jquery/module/customService/promotion/partials/edit_multi.js
code/static/js.jquery/module/customService/promotion/partials/log_view.js
code/apps/customService/controllers/promotion.js
View file @
9c8cb7c
...
...
@@ -59,4 +59,8 @@ module.exports = function (app){
});
//促销列表
app
.
post
(
"/promotionInfo/log/list"
,
"promotion_getPromotionLogList"
);
//促销多档
app
.
post
(
"/promotion/setMulti"
,
"promotion_setMulti"
);
app
.
post
(
"/promotion/getMultiPromotionPage"
,
"promotion_getMultiPromotionPage"
);
}
\ No newline at end of file
...
...
code/apps/customService/interfaces/promotion.js
View file @
9c8cb7c
...
...
@@ -104,6 +104,22 @@ module.exports={
{
name
:
'shoppingCartBanner'
,
type
:
'string'
},
]
},
setMulti
:{
title
:
"设置促销多档"
,
url
:
"/promotion/setMulti"
,
params
:[{
name
:
'promotionId'
,
type
:
'Number'
},
{
name
:
'multiParam'
,
type
:
'string'
}]
},
getMultiPromotionPage
:{
title
:
"促销多档列表"
,
url
:
"/promotion/getMultiPromotionPage"
,
params
:[
{
name
:
'id'
,
type
:
'Number'
},
{
name
:
'promotionType'
,
type
:
'string'
},
{
name
:
'page'
,
type
:
'Number'
},
{
name
:
'size'
,
type
:
'Number'
}
]
},
getActivePromotionInfoList
:{
title
:
"设置促销显示"
,
url
:
"/promotion/getActivePromotionInfoList"
,
...
...
code/apps/customService/views/promotion/Edit.html
View file @
9c8cb7c
...
...
@@ -36,5 +36,8 @@
<script
type=
"text/template"
id=
"fm_display"
>
<%
include
'./__fragement/display'
%>
</script>
<script
type=
"text/template"
id=
"fm_multi"
>
<%
include
'./__fragement/multi'
%>
</script>
<
%include '../../../common/views/__ui/footer'%>
\ No newline at end of file
...
...
code/apps/customService/views/promotion/LogIndex.html
View file @
9c8cb7c
...
...
@@ -33,6 +33,7 @@
<option
value=
"6"
>
修改操作
</option>
<option
value=
"7"
>
修改条件
</option>
<option
value=
"8"
>
修改显示
</option>
<option
value=
"9"
>
修改多档
</option>
</select>
</div>
<div
class=
"panel-col"
>
...
...
@@ -75,5 +76,7 @@
<script
type=
"text/template"
id=
"fm_display"
>
<%
include
'./__fragement/display'
%>
</script>
<script
type=
"text/template"
id=
"fm_multi"
>
<%
include
'./__fragement/multi'
%>
</script>
<
%include '../../../common/views/__ui/footer'%>
\ No newline at end of file
...
...
code/apps/customService/views/promotion/__fragement/multi.html
0 → 100644
View file @
9c8cb7c
<form
id=
"form_limit"
>
<div
class=
"row"
>
<div
class=
"dataTables_length"
id=
"basicTable_promotion"
></div>
</div>
<input
type=
"hidden"
id=
"promotionId"
value=
"[[promotionId]]"
>
<div
class=
"panel-footer"
>
<button
class=
"btn btn-primary"
id=
"save_multi"
>
保存
</button>
</div>
</form>
\ No newline at end of file
...
...
code/static/js.jquery/module/customService/promotion/Edit.js
View file @
9c8cb7c
...
...
@@ -8,6 +8,7 @@ var operationEdit=require('./partials/edit_operation');
var
conditionEdit
=
require
(
'./partials/edit_condition'
);
var
displayEdit
=
require
(
'./partials/edit_display'
);
var
limitEdit
=
require
(
'./partials/edit_limit'
);
var
multiEdit
=
require
(
'./partials/edit_multi'
)
/*
* 获取业务数据
...
...
@@ -22,7 +23,8 @@ var ENUM = {
'2'
:
0
,
'3'
:
0
,
'4'
:
0
,
'5'
:
0
'5'
:
0
,
'6'
:
0
},
tabName
:[
{
en
:
"baseinfo"
,
cn
:
"基本信息"
},
...
...
@@ -30,7 +32,9 @@ var ENUM = {
{
en
:
"operation"
,
cn
:
"促销操作"
},
{
en
:
"limit"
,
cn
:
"促销限制"
},
{
en
:
"reject"
,
cn
:
"互斥促销"
},
{
en
:
"display"
,
cn
:
"促销显示"
},]
{
en
:
"display"
,
cn
:
"促销显示"
},
{
en
:
"multi"
,
cn
:
"多档"
}
]
};
var
fixDateTime
=
function
(){
if
(
PromotionInfo
.
startTime
&&
PromotionInfo
.
startTime
>
0
){
...
...
@@ -92,6 +96,12 @@ var tabLoader={
$
(
"#tab_body"
).
html
(
html_display
);
displayEdit
.
load
(
config_data
);
}
else
if
(
columnname
===
ENUM
.
tabName
[
6
].
en
)
{
//multi
// 加载促销列表
var
html_promotions
=
$
(
"#fm_multi"
).
html
();
$
(
"#tab_body"
).
html
(
html_promotions
);
var
_multiData
=
buildMultiData
();
multiEdit
.
init
(
$
.
extend
(
_multiData
,
config_data
));
}
}
};
...
...
@@ -154,6 +164,22 @@ var buildRejectData=function(){
endTimeStr
:
PromotionInfo
.
endTimeStr
};
}
var
buildMultiData
=
function
(){
var
_multi
=
[];
if
(
PromotionInfo
.
promotionParams
&&
PromotionInfo
.
promotionParams
.
multiParam
){
_multi
=
JSON
.
parse
(
PromotionInfo
.
promotionParams
.
multiParam
);
}
var
_promotionType
;
if
(
PromotionInfo
.
promotionParams
&&
PromotionInfo
.
promotionParams
.
promotionType
){
_promotionType
=
PromotionInfo
.
promotionParams
.
promotionType
;
}
return
{
promotionId
:
PromotionInfo
.
id
,
multi
:
_multi
,
promotionType
:
_promotionType
};
}
//build Operation Data
var
buildOperationData
=
function
(){
var
_promotionType
;
...
...
@@ -204,6 +230,10 @@ var t = new common.tab2({
name
:
ENUM
.
tabName
[
5
].
en
,
value
:
'all'
,
display
:
ENUM
.
tabName
[
5
].
cn
},{
name
:
ENUM
.
tabName
[
6
].
en
,
value
:
'0'
,
display
:
ENUM
.
tabName
[
6
].
cn
}]
}).
init
(
ENUM
.
tab
);
//默认加载
...
...
code/static/js.jquery/module/customService/promotion/LogIndex.js
View file @
9c8cb7c
...
...
@@ -55,6 +55,7 @@ var g = new common.grid({
case
6
:
name
=
"修改操作"
;
break
;
case
7
:
name
=
"修改条件"
;
break
;
case
8
:
name
=
"修改显示"
;
break
;
case
9
:
name
=
"修改多档"
;
break
;
}
return
name
;
...
...
@@ -156,6 +157,13 @@ var view={
appendHtml
+=
shoppingCartBanner_span
.
prop
(
"outerHTML"
);
}
break
;
case
9
:
tempId
=
"fm_multi"
;
if
(
typeof
column_data
.
promotionInfoBo
.
promotionParams
.
multiParam
==
'string'
){
var
multiParam
=
JSON
.
parse
(
column_data
.
promotionInfoBo
.
promotionParams
.
multiParam
);
loadData
.
promotionParams
.
multiParam
=
multiParam
;
}
break
;
}
...
...
code/static/js.jquery/module/customService/promotion/partials/edit_multi.js
0 → 100644
View file @
9c8cb7c
var
$
=
require
(
'jquery'
),
common
=
require
(
'../../../../common/common'
);
var
promotionInfoRefresh
=
require
(
'./promotionInfoRefresh'
);
console
.
log
(
"multiPromotions in"
);
var
multiPromotions
=
{
tabLoader
:
null
,
columnName
:
null
,
batchIds
:[],
pageIds
:[],
buildCheckboxHtml
:
function
(
_class
,
_data_index
,
_checked
){
var
_checkBox
=
"<input type='checkbox'"
;
var
_end
=
"/>"
;
if
(
_class
){
_checkBox
+=
" class='"
+
_class
+
"'"
;
}
if
(
_data_index
>=
0
){
_checkBox
+=
" data-index='"
+
_data_index
+
"'"
;
}
if
(
_checked
){
console
.
log
(
"_checkBox"
,
_checkBox
);
_checkBox
+=
" checked='"
+
_checked
+
"'"
;
}
_checkBox
+=
_end
;
return
_checkBox
;
},
getParam
:
function
(
_config
){
var
g
=
this
;
/*
var _buildCheckboxHtml = function (_class,_data_index,_checked) {
return this.buildCheckboxHtml(_class,_data_index,_checked);
};*/
var
param
=
{
el
:
'#basicTable_promotion'
,
size
:
20
,
parms
:
function
(){
return
_config
.
parmsData
},
columns
:
[
{
display
:
''
,
type
:
'checkbox'
,
render
:
function
(
item
)
{
var
htmlContent
=
""
;
var
_class
=
"wqt_checkbox"
;
if
(
g
.
batchIds
.
length
===
0
){
htmlContent
=
g
.
buildCheckboxHtml
(
_class
,
item
.
__index
);
}
else
{
$
.
each
(
g
.
batchIds
,
function
(
n
,
value
)
{
if
(
item
.
id
==
value
){
htmlContent
=
g
.
buildCheckboxHtml
(
_class
,
item
.
__index
,
"checked"
);
return
false
}
else
{
htmlContent
=
"<input type='checkbox' class='wqt_checkbox' data-index='"
+
item
.
__index
+
"'>"
;
htmlContent
=
g
.
buildCheckboxHtml
(
_class
,
item
.
__index
);
}
})
}
return
htmlContent
;
}
},{
display
:
"ID"
,
name
:
"id"
,
render
:
function
(
item
)
{
g
.
pageIds
.
push
(
item
.
id
);
return
item
.
id
;
}
},
{
display
:
"促销名称"
,
name
:
"title"
},
{
display
:
'优先级'
,
name
:
"priority"
},
{
display
:
'开始时间'
,
name
:
"startTime"
,
render
:
function
(
item
)
{
var
date
=
new
Date
(
item
.
startTime
*
1000
);
return
date
.
getFullYear
()
+
'-'
+
(
date
.
getMonth
()
+
1
)
+
'-'
+
date
.
getDate
()
+
' '
+
date
.
getHours
()
+
':'
+
date
.
getMinutes
()
+
':'
+
date
.
getSeconds
();
}
},
{
display
:
'结束时间'
,
name
:
"endTime"
,
render
:
function
(
item
)
{
var
date
=
new
Date
(
item
.
endTime
*
1000
);
return
date
.
getFullYear
()
+
'-'
+
(
date
.
getMonth
()
+
1
)
+
'-'
+
date
.
getDate
()
+
' '
+
date
.
getHours
()
+
':'
+
date
.
getMinutes
()
+
':'
+
date
.
getSeconds
();
}
},
{
display
:
'是否启用'
,
name
:
"status"
,
render
:
function
(
item
)
{
if
(
item
.
status
==
1
){
var
name
=
"已启用"
;
}
else
{
var
name
=
"未启用"
;
}
return
name
;
}
}],
selectedCallback
:
function
(
item
){
if
(
$
.
inArray
(
item
.
id
,
g
.
batchIds
)
==
-
1
){
g
.
batchIds
.
push
(
item
.
id
);
}
console
.
log
(
"batchIds"
,
g
.
batchIds
);
},
unselectedCallback
:
function
(
item
){
var
_index
=
$
.
inArray
(
item
.
id
,
g
.
batchIds
);
if
(
_index
!=
-
1
){
g
.
batchIds
.
splice
(
_index
,
1
);
}
console
.
log
(
"batchIds"
,
g
.
batchIds
);
},
complete
:
function
(){
//渲染表头是否勾选
$
.
each
(
g
.
pageIds
,
function
(
i
,
pageItem
)
{
if
(
$
.
inArray
(
pageItem
,
g
.
batchIds
)
==
-
1
)
{
$
(
".wqt_all"
).
prop
(
"checked"
,
false
);
return
false
;
}
$
(
".wqt_all"
).
prop
(
"checked"
,
true
);
});
g
.
pageIds
=
[];
}
};
return
param
;
},
bindGrid
:
function
(
param
){
return
new
common
.
grid
(
param
);
},
promotionId
:
null
,
grid
:
null
,
actionUrl
:
"/promotion/setMulti"
,
init
:
function
(
_config
){
this
.
batchIds
=
_config
.
multi
||
[];
var
parmsData
=
{
id
:
_config
.
promotionId
};
var
g
=
this
,
_param
=
this
.
getParam
({
parmsData
:
parmsData
});
this
.
promotionId
=
_config
.
promotionId
;
if
(
!
g
.
tabLoader
){
g
.
tabLoader
=
_config
.
tabLoader
;
}
if
(
!
g
.
columnName
){
g
.
columnName
=
_config
.
columnName
;
}
if
(
!
this
.
grid
||
this
.
grid
===
null
){
this
.
grid
=
g
.
bindGrid
(
_param
);
}
this
.
grid
.
init
(
"/promotion/getMultiPromotionPage"
);
this
.
bindEvent
();
},
reload
:
function
(){
var
g
=
this
,
_grid
=
this
.
grid
;
_grid
.
reload
(
1
);
},
bindEvent
:
function
()
{
var
_g
=
this
;
$
(
'#save_multi'
).
off
();
$
(
'#save_multi'
).
on
(
'click'
,
function
(){
return
_g
.
save
()});
},
save
:
function
(){
var
_g
=
this
;
var
multiParam
=
""
;
if
(
_g
.
batchIds
&&
_g
.
batchIds
.
length
>
0
){
multiParam
+=
"["
;
multiParam
+=
_g
.
batchIds
.
join
(
","
);
multiParam
+=
"]"
;
}
else
{
common
.
util
.
__tip
(
"没有选择任何促销"
,
"warning"
);
return
;
}
var
reqData
=
{
promotionId
:
_g
.
promotionId
,
multiParam
:
multiParam
};
var
_options
=
{
url
:
_g
.
actionUrl
,
data
:
reqData
};
common
.
util
.
__ajax2
(
_options
,
function
(
res
)
{
if
(
res
.
code
==
"200"
)
{
common
.
util
.
__tip
(
"提交成功"
,
"success"
);
//location.href = "/promotionInfo/edit/"+_g.promotionId||"";
promotionInfoRefresh
.
refresh
({
tabLoader
:
_g
.
tabLoader
,
columnName
:
_g
.
columnName
,
promotionId
:
_g
.
promotionId
});
}
else
{
common
.
util
.
__tip
(
res
.
message
,
"warning"
);
}
return
false
;
},
function
(
res
)
{
common
.
util
.
__tip
(
res
.
message
,
"warning"
);
return
false
;
});
return
false
;
}
}
module
.
exports
=
multiPromotions
;
\ No newline at end of file
...
...
code/static/js.jquery/module/customService/promotion/partials/log_view.js
View file @
9c8cb7c
...
...
@@ -37,6 +37,16 @@ var buildRejectData=function(){
endTimeStr
:
PromotionInfo
.
endTimeStr
};
}
var
buildMultiData
=
function
(){
var
_multi
=
[];
if
(
PromotionInfo
.
promotionParams
&&
PromotionInfo
.
promotionParams
.
multiParam
){
_multi
=
JSON
.
parse
(
PromotionInfo
.
promotionParams
.
multiParam
);
}
return
{
promotionId
:
PromotionInfo
.
id
,
multi
:
_multi
};
}
//build Operation Data
var
buildOperationData
=
function
(){
var
_promotionType
;
...
...
@@ -109,6 +119,10 @@ var logView={
tempId
=
"fm_display"
;
loadData
=
column_data
.
promotionInfoBo
;
break
;
case
9
:
tempId
=
"fm_multi"
;
loadData
=
column_data
.
promotionInfoBo
.
promotionParams
;
break
;
}
...
...
@@ -149,6 +163,12 @@ var logView={
$
(
"#modal-body"
).
html
(
html_display
);
displayEdit
.
load
(
config_data
);
}
else
if
(
columnname
===
ENUM
.
tabName
[
6
].
en
)
{
//multi
// 加载促销列表
var
html_promotions
=
$
(
"#fm_multi"
).
html
();
$
(
"#modal-body"
).
html
(
html_promotions
);
var
_multiData
=
buildMultiData
();
rejectPromotions
.
init
(
$
.
extend
(
_multiData
,
config_data
));
}
}
};
...
...
Please
register
or
login
to post a comment