Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
farming
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郑云飞
farming
Commits
327439c0
Commit
327439c0
authored
May 18, 2023
by
郑云飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后管团购管理功能完成
parent
c58dbf9f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
308 additions
and
21 deletions
+308
-21
src/main/java/com/yunniu/farming/webadmin/controller/GroupBuyController.java
+64
-2
src/main/java/com/yunniu/farming/webadmin/model/GroupBuy.java
+6
-0
src/main/java/com/yunniu/farming/webadmin/service/GroupAreaService.java
+3
-0
src/main/java/com/yunniu/farming/webadmin/service/GroupBuyService.java
+10
-1
src/main/java/com/yunniu/farming/webadmin/service/impl/GroupAreaServiceimpl.java
+7
-0
src/main/java/com/yunniu/farming/webadmin/service/impl/GroupBuyServiceimpl.java
+46
-14
src/main/resources/mappings/GroupBuyProductMapper.xml
+4
-1
src/main/resources/static/js/layui.min.js
+2
-0
src/main/resources/static/js/layui/css/layui.main.css
+0
-0
src/main/resources/templates/groupBuy/addOrEdit.html
+0
-0
src/main/resources/templates/groupBuy/list.html
+18
-3
src/main/resources/templates/groupBuy/productList.html
+148
-0
No files found.
src/main/java/com/yunniu/farming/webadmin/controller/GroupBuyController.java
View file @
327439c0
...
...
@@ -9,6 +9,7 @@ import com.yunniu.farming.result.Result;
import
com.yunniu.farming.webadmin.model.GroupArea
;
import
com.yunniu.farming.webadmin.model.GroupBuy
;
import
com.yunniu.farming.webadmin.model.Product
;
import
com.yunniu.farming.webadmin.service.GroupAreaService
;
import
com.yunniu.farming.webadmin.service.GroupBuyService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -30,12 +31,19 @@ public class GroupBuyController {
@Autowired
private
GroupBuyService
groupBuyService
;
@Autowired
private
GroupAreaService
groupAreaService
;
@RequestMapping
(
value
=
"/list"
)
public
String
list
(
Model
model
)
{
return
"groupBuy/list"
;
}
@RequestMapping
(
value
=
"/productList"
)
public
String
productList
(
Model
model
)
{
return
"groupBuy/productList"
;
}
@RequestMapping
(
value
=
"/addOrEdit"
)
public
String
addOrEdit
(
Model
model
,
Long
id
)
{
model
.
addAttribute
(
"id"
,
id
);
...
...
@@ -45,6 +53,8 @@ public class GroupBuyController {
GroupBuy
groupBuy
=
groupBuyService
.
findById
(
id
);
model
.
addAttribute
(
"obj"
,
groupBuy
);
}
List
<
GroupArea
>
areas
=
groupAreaService
.
findList
();
model
.
addAttribute
(
"areaList"
,
areas
);
return
"/groupBuy/addOrEdit"
;
}
...
...
@@ -123,8 +133,60 @@ public class GroupBuyController {
if
(
CollectionUtils
.
isEmpty
(
item
.
getProducts
())){
return
Result
.
error
(
"商品不能为空"
);
}
this
.
groupBuyService
.
addOrEdit
(
item
);
return
Result
.
success
();
return
this
.
groupBuyService
.
addOrEdit
(
item
);
}
/**
* 分页查询商品
* @return
*/
@RequestMapping
(
value
=
"/getProductList"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Result
productList
(
@RequestBody
Product
item
)
{
//这里对返回对象用Map处理,map.pageinfo=>分页信息;map.items=>结果数据集;
Map
<
String
,
Object
>
rmap
=
new
HashMap
<
String
,
Object
>(
2
);
//传入当前页数,适配PC端Layui分页
if
(
item
.
getCurpage
()
!=
null
||
item
.
getPagesize
()
!=
null
)
{
PageInfo
pinfo
=
new
PageInfo
();
if
(
item
.
getCurpage
()
!=
null
)
{
pinfo
.
setCurPage
(
item
.
getCurpage
());
}
if
(
item
.
getPagesize
()
!=
null
)
{
pinfo
.
setPageSize
(
item
.
getPagesize
());
}
item
.
setPageinfo
(
pinfo
);
}
// 1.查询前 需要对分页对象 做处理,主要是 分页 开始记录数 limit arg0开始记录,arg1每页几条记录
PageInfo
pinfo
=
item
.
getPageinfo
();
if
(
pinfo
==
null
)
{
pinfo
=
new
PageInfo
();
item
.
setPageinfo
(
pinfo
);
}
else
{
// 分页开始记录数
int
curRecord
=
(
pinfo
.
getCurPage
()
-
1
)
*
pinfo
.
getPageSize
();
pinfo
.
setCurRecord
(
curRecord
);
item
.
setPageinfo
(
pinfo
);
}
List
<
Product
>
list
=
groupBuyService
.
productList
(
item
);
// 3.将查询结果的 分页数据封装后返回
int
totalRs
=
pinfo
.
getTotalRecords
();
//总记录数
int
totalPs
=
0
;
//总页数
if
(
totalRs
%
pinfo
.
getPageSize
()
==
0
)
{
//总页数计算
totalPs
=
totalRs
/
pinfo
.
getPageSize
();
}
else
{
totalPs
=
1
+
totalRs
/
pinfo
.
getPageSize
();
}
pinfo
.
setTotalPages
(
totalPs
);
// 4.将分页对象、结果集合 封装后返回前台
rmap
.
put
(
"pageinfo"
,
pinfo
);
rmap
.
put
(
"items"
,
list
);
return
Result
.
success
(
rmap
);
}
}
src/main/java/com/yunniu/farming/webadmin/model/GroupBuy.java
View file @
327439c0
package
com
.
yunniu
.
farming
.
webadmin
.
model
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.yunniu.farming.common.plugin.PageInfo
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.math.BigDecimal
;
import
java.util.Date
;
...
...
@@ -45,11 +47,15 @@ public class GroupBuy {
/**
* 拼团开始时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
startTime
;
/**
* 拼团结束时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
endTime
;
/**
...
...
src/main/java/com/yunniu/farming/webadmin/service/GroupAreaService.java
View file @
327439c0
...
...
@@ -23,4 +23,7 @@ public interface GroupAreaService {
List
<
GroupArea
>
getPageList
(
GroupArea
item
);
GroupArea
findById
(
Long
areaId
);
List
<
GroupArea
>
findList
();
}
src/main/java/com/yunniu/farming/webadmin/service/GroupBuyService.java
View file @
327439c0
package
com
.
yunniu
.
farming
.
webadmin
.
service
;
import
com.yunniu.farming.result.Result
;
import
com.yunniu.farming.webadmin.model.GroupBuy
;
import
com.yunniu.farming.webadmin.model.Product
;
import
java.util.List
;
...
...
@@ -17,7 +19,7 @@ public interface GroupBuyService {
*/
List
<
GroupBuy
>
findPageList
(
GroupBuy
item
);
void
addOrEdit
(
GroupBuy
item
);
Result
addOrEdit
(
GroupBuy
item
);
/**
* 详情
...
...
@@ -25,4 +27,11 @@ public interface GroupBuyService {
* @return
*/
GroupBuy
findById
(
Long
id
);
/**
* 分页查询商品列表
* @param item
* @return
*/
List
<
Product
>
productList
(
Product
item
);
}
src/main/java/com/yunniu/farming/webadmin/service/impl/GroupAreaServiceimpl.java
View file @
327439c0
package
com
.
yunniu
.
farming
.
webadmin
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.mysql.cj.xdevapi.Warning
;
import
com.yunniu.farming.result.Result
;
import
com.yunniu.farming.webadmin.dao.GroupAreaDao
;
import
com.yunniu.farming.webadmin.dao.GroupBuyDao
;
...
...
@@ -78,4 +80,9 @@ public class GroupAreaServiceimpl implements GroupAreaService {
public
GroupArea
findById
(
Long
areaId
)
{
return
mapper
.
selectById
(
areaId
);
}
@Override
public
List
<
GroupArea
>
findList
()
{
return
mapper
.
selectList
(
Wrappers
.<
GroupArea
>
lambdaQuery
().
eq
(
GroupArea:
:
getAreaStatus
,
0
));
}
}
src/main/java/com/yunniu/farming/webadmin/service/impl/GroupBuyServiceimpl.java
View file @
327439c0
...
...
@@ -5,14 +5,13 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import
com.baomidou.mybatisplus.core.toolkit.ObjectUtils
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.yunniu.farming.webadmin.dao.GroupAreaDao
;
import
com.yunniu.farming.webadmin.dao.GroupBuyDao
;
import
com.yunniu.farming.webadmin.dao.GroupBuyProductDao
;
import
com.yunniu.farming.webadmin.dao.OrderMainDao
;
import
com.yunniu.farming.webadmin.model.GroupArea
;
import
com.yunniu.farming.webadmin.model.GroupBuy
;
import
com.yunniu.farming.webadmin.model.GroupBuyProduct
;
import
com.yunniu.farming.webadmin.model.OrderMain
;
import
com.yunniu.farming.result.Result
;
import
com.yunniu.farming.util.COSUtil
;
import
com.yunniu.farming.util.FileUtil
;
import
com.yunniu.farming.util.ImageUtil
;
import
com.yunniu.farming.util.UUIDUtils
;
import
com.yunniu.farming.webadmin.dao.*
;
import
com.yunniu.farming.webadmin.model.*
;
import
com.yunniu.farming.webadmin.service.GroupBuyProductService
;
import
com.yunniu.farming.webadmin.service.GroupBuyService
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -34,14 +33,15 @@ public class GroupBuyServiceimpl implements GroupBuyService {
@Autowired
private
GroupBuyDao
mapper
;
@Autowired
private
GroupBuyProductDao
p
roductDao
;
private
GroupBuyProductDao
groupBuyP
roductDao
;
@Autowired
private
GroupAreaDao
areaDao
;
@Autowired
private
OrderMainDao
orderMain
Dao
;
private
ProductDao
product
Dao
;
/**
* 分页查询
*
* @return
*/
@Override
...
...
@@ -52,29 +52,50 @@ public class GroupBuyServiceimpl implements GroupBuyService {
/**
* 新增/编辑活动
*
* @param item
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
addOrEdit
(
GroupBuy
item
)
{
public
Result
addOrEdit
(
GroupBuy
item
)
{
// 判断是否为新增
if
(
ObjectUtils
.
isEmpty
(
item
.
getId
()))
{
String
imgArr
=
item
.
getGroupBuyPic
();
String
pics
=
""
;
if
(
StringUtils
.
isNotEmpty
(
imgArr
))
{
if
(
imgArr
.
startsWith
(
"data:image"
))
{
String
suffix
=
imgArr
.
substring
(
imgArr
.
indexOf
(
"/"
)
+
1
,
imgArr
.
indexOf
(
";"
));
String
realpath
=
FileUtil
.
BasePath
+
"/group/"
+
UUIDUtils
.
getUUID
()
+
"."
+
suffix
;
String
url
=
COSUtil
.
uploadFileByPath
(
realpath
);
pics
=
url
;
}
}
if
(
""
.
equals
(
pics
))
{
return
Result
.
error
(
"图片不能为空!"
);
}
item
.
setGroupBuyPic
(
pics
);
// 设置小区id集合的值
item
.
setAreaIds
(
JSON
.
toJSONString
(
item
.
getAreaIdList
()));
item
.
setGroupStatus
(
3
);
// 保存活动基础信息
this
.
mapper
.
insert
(
item
);
// 判断活动商品是否有值
if
(
CollectionUtils
.
isNotEmpty
(
item
.
getProducts
()))
{
// 保存活动商品
p
roductDao
.
insertBath
(
item
.
getProducts
(),
item
.
getId
());
groupBuyP
roductDao
.
insertBath
(
item
.
getProducts
(),
item
.
getId
());
}
}
else
{
return
Result
.
success
();
}
else
{
this
.
mapper
.
updateEndTime
(
item
);
return
Result
.
success
();
}
}
/**
* 详情
*
* @param id 团购id
* @return
*/
...
...
@@ -83,7 +104,7 @@ public class GroupBuyServiceimpl implements GroupBuyService {
// 团购基础信息
GroupBuy
groupBuy
=
this
.
mapper
.
selectById
(
id
);
// 团购商品
List
<
GroupBuyProduct
>
products
=
p
roductDao
.
selectList
(
Wrappers
.<
GroupBuyProduct
>
lambdaQuery
()
List
<
GroupBuyProduct
>
products
=
groupBuyP
roductDao
.
selectList
(
Wrappers
.<
GroupBuyProduct
>
lambdaQuery
()
.
eq
(
GroupBuyProduct:
:
getGroupBuyId
,
id
)
.
eq
(
GroupBuyProduct:
:
getStatus
,
0
));
groupBuy
.
setProducts
(
products
);
...
...
@@ -100,4 +121,15 @@ public class GroupBuyServiceimpl implements GroupBuyService {
}
return
groupBuy
;
}
/**
* 分页查询商品列表
*
* @param item
* @return
*/
@Override
public
List
<
Product
>
productList
(
Product
item
)
{
return
productDao
.
selectByParamPageList
(
item
);
}
}
src/main/resources/mappings/GroupBuyProductMapper.xml
View file @
327439c0
...
...
@@ -7,9 +7,11 @@
(group_buy_id, product_id, product_name,
product_sduction, product_price,`status`, create_by)
values
<foreach
collection=
"products"
close=
")"
index=
"index"
item=
"item"
open=
"("
separator=
","
>
<foreach
collection=
"products"
index=
"index"
item=
"item"
separator=
","
>
(
#{id,jdbcType=BIGINT}, #{item.productId}, #{item.productName},
#{item.productSduction}, #{item.productPrice}, 0, #{item.createBy}
)
</foreach>
</insert>
</mapper>
\ No newline at end of file
src/main/resources/static/js/layui.min.js
0 → 100644
View file @
327439c0
!
function
(
r
){
"use strict"
;
function
n
(){
this
.
v
=
"2.5.6"
}
function
d
(
e
){
r
.
console
&&
console
.
error
&&
console
.
error
(
"Layui hint: "
+
e
)}
var
e
,
f
=
document
,
m
=
{
modules
:{},
status
:{},
timeout
:
10
,
event
:{}},
h
=
(
e
=
f
.
currentScript
?
f
.
currentScript
.
src
:
function
(){
for
(
var
e
,
t
=
f
.
scripts
,
o
=
t
.
length
-
1
,
n
=
o
;
0
<
n
;
n
--
)
if
(
"interactive"
===
t
[
n
].
readyState
){
e
=
t
[
n
].
src
;
break
}
return
e
||
t
[
o
].
src
}()).
substring
(
0
,
e
.
lastIndexOf
(
"/"
)
+
1
),
v
=
"undefined"
!=
typeof
opera
&&
"[object Opera]"
===
opera
.
toString
(),
g
=
{
layer
:
"modules/layer"
,
laydate
:
"modules/laydate"
,
laypage
:
"modules/laypage"
,
laytpl
:
"modules/laytpl"
,
layim
:
"modules/layim"
,
layedit
:
"modules/layedit"
,
form
:
"modules/form"
,
upload
:
"modules/upload"
,
transfer
:
"modules/transfer"
,
tree
:
"modules/tree"
,
table
:
"modules/table"
,
element
:
"modules/element"
,
rate
:
"modules/rate"
,
colorpicker
:
"modules/colorpicker"
,
slider
:
"modules/slider"
,
carousel
:
"modules/carousel"
,
flow
:
"modules/flow"
,
util
:
"modules/util"
,
code
:
"modules/code"
,
jquery
:
"modules/jquery"
,
mobile
:
"modules/mobile"
,
"layui.all"
:
"../layui.all"
};
n
.
prototype
.
cache
=
m
,
n
.
prototype
.
define
=
function
(
e
,
n
){
function
t
(){
function
o
(
e
,
t
){
layui
[
e
]
=
t
,
m
.
status
[
e
]
=!
0
}
return
"function"
==
typeof
n
&&
n
(
function
(
e
,
t
){
o
(
e
,
t
),
m
.
callback
[
e
]
=
function
(){
n
(
o
)}}),
this
}
var
o
=
this
;
return
"function"
==
typeof
e
&&
(
n
=
e
,
e
=
[]),
!
layui
[
"layui.all"
]
&&
layui
[
"layui.mobile"
]?
t
.
call
(
o
):(
o
.
use
(
e
,
t
),
o
)},
n
.
prototype
.
use
=
function
(
o
,
e
,
t
){
function
n
(
e
,
t
){
var
o
=
"PLaySTATION 3"
===
navigator
.
platform
?
/^complete$/
:
/^
(
complete|loaded
)
$/
;
"load"
!==
e
.
type
&&!
o
.
test
((
e
.
currentTarget
||
e
.
srcElement
).
readyState
)
||
(
m
.
modules
[
u
]
=
t
,
l
.
removeChild
(
c
),
function
e
(){
return
++
s
>
1
e3
*
m
.
timeout
/
4
?
d
(
u
+
" is not a valid module"
):
void
(
m
.
status
[
u
]?
r
():
setTimeout
(
e
,
4
))}())}
function
r
(){
t
.
push
(
layui
[
u
]),
1
<
o
.
length
?
a
.
use
(
o
.
slice
(
1
),
e
,
t
):
"function"
==
typeof
e
&&
e
.
apply
(
layui
,
t
)}
var
a
=
this
,
i
=
m
.
dir
=
m
.
dir
?
m
.
dir
:
h
,
l
=
f
.
getElementsByTagName
(
"head"
)[
0
];
o
=
"string"
==
typeof
o
?[
o
]:
o
,
window
.
jQuery
&&
jQuery
.
fn
.
on
&&
(
a
.
each
(
o
,
function
(
e
,
t
){
"jquery"
===
t
&&
o
.
splice
(
e
,
1
)}),
layui
.
jquery
=
layui
.
$
=
jQuery
);
var
u
=
o
[
0
],
s
=
0
;
if
(
t
=
t
||
[],
m
.
host
=
m
.
host
||
(
i
.
match
(
/
\/\/([\s\S]
+
?)\/
/
)
||
[
"//"
+
location
.
host
+
"/"
])[
0
],
0
===
o
.
length
||
layui
[
"layui.all"
]
&&
g
[
u
]
||!
layui
[
"layui.all"
]
&&
layui
[
"layui.mobile"
]
&&
g
[
u
])
return
r
(),
a
;
var
c
,
p
,
y
=
(
y
=
(
g
[
u
]?
i
+
"lay/"
:
!
/^
\{\/\}
/
.
test
(
a
.
modules
[
u
])
&&
m
.
base
||
""
)
+
(
a
.
modules
[
u
]
||
u
)
+
".js"
).
replace
(
/^
\{\/\}
/
,
""
);
return
!
m
.
modules
[
u
]
&&
layui
[
u
]
&&
(
m
.
modules
[
u
]
=
y
),
m
.
modules
[
u
]?
function
e
(){
return
++
s
>
1
e3
*
m
.
timeout
/
4
?
d
(
u
+
" is not a valid module"
):
void
(
"string"
==
typeof
m
.
modules
[
u
]
&&
m
.
status
[
u
]?
r
():
setTimeout
(
e
,
4
))}():((
c
=
f
.
createElement
(
"script"
)).
async
=!
0
,
c
.
charset
=
"utf-8"
,
c
.
src
=
y
+
((
p
=!
0
===
m
.
version
?
m
.
v
||
(
new
Date
).
getTime
():
m
.
version
||
""
)?
"?v="
+
p
:
""
),
l
.
appendChild
(
c
),
!
c
.
attachEvent
||
c
.
attachEvent
.
toString
&&
c
.
attachEvent
.
toString
().
indexOf
(
"[native code"
)
<
0
||
v
?
c
.
addEventListener
(
"load"
,
function
(
e
){
n
(
e
,
y
)},
!
1
):
c
.
attachEvent
(
"onreadystatechange"
,
function
(
e
){
n
(
e
,
y
)}),
m
.
modules
[
u
]
=
y
),
a
},
n
.
prototype
.
getStyle
=
function
(
e
,
t
){
var
o
=
e
.
currentStyle
?
e
.
currentStyle
:
r
.
getComputedStyle
(
e
,
null
);
return
o
[
o
.
getPropertyValue
?
"getPropertyValue"
:
"getAttribute"
](
t
)},
n
.
prototype
.
link
=
function
(
t
,
o
,
e
){
var
n
=
this
,
r
=
f
.
createElement
(
"link"
),
a
=
f
.
getElementsByTagName
(
"head"
)[
0
];
"string"
==
typeof
o
&&
(
e
=
o
);
var
i
=
(
e
||
t
).
replace
(
/
\.
|
\/
/g
,
""
),
l
=
r
.
id
=
"layuicss-"
+
i
,
u
=
0
;
return
r
.
rel
=
"stylesheet"
,
r
.
href
=
t
+
(
m
.
debug
?
"?v="
+
(
new
Date
).
getTime
():
""
),
r
.
media
=
"all"
,
f
.
getElementById
(
l
)
||
a
.
appendChild
(
r
),
"function"
!=
typeof
o
||
function
e
(){
return
++
u
>
1
e3
*
m
.
timeout
/
100
?
d
(
t
+
" timeout"
):
void
(
1989
===
parseInt
(
n
.
getStyle
(
f
.
getElementById
(
l
),
"width"
))?
o
():
setTimeout
(
e
,
100
))}(),
n
},
m
.
callback
=
{},
n
.
prototype
.
factory
=
function
(
e
){
if
(
layui
[
e
])
return
"function"
==
typeof
m
.
callback
[
e
]?
m
.
callback
[
e
]:
null
},
n
.
prototype
.
addcss
=
function
(
e
,
t
,
o
){
return
layui
.
link
(
m
.
dir
+
"css/"
+
e
,
t
,
o
)},
n
.
prototype
.
img
=
function
(
e
,
t
,
o
){
var
n
=
new
Image
;
return
n
.
src
=
e
,
n
.
complete
?
t
(
n
):(
n
.
onload
=
function
(){
n
.
onload
=
null
,
"function"
==
typeof
t
&&
t
(
n
)},
void
(
n
.
onerror
=
function
(
e
){
n
.
onerror
=
null
,
"function"
==
typeof
o
&&
o
(
e
)}))},
n
.
prototype
.
config
=
function
(
e
){
for
(
var
t
in
e
=
e
||
{})
m
[
t
]
=
e
[
t
];
return
this
},
n
.
prototype
.
modules
=
function
(){
var
e
=
{};
for
(
var
t
in
g
)
e
[
t
]
=
g
[
t
];
return
e
}(),
n
.
prototype
.
extend
=
function
(
e
){
for
(
var
t
in
e
=
e
||
{})
this
[
t
]
||
this
.
modules
[
t
]?
d
(
"模块名 "
+
t
+
" 已被占用"
):
this
.
modules
[
t
]
=
e
[
t
];
return
this
},
n
.
prototype
.
router
=
function
(
e
){
var
o
=
{
path
:[],
search
:{},
hash
:((
e
=
e
||
location
.
hash
).
match
(
/
[^
#
](
#.*$
)
/
)
||
[])[
1
]
||
""
};
return
/^#
\/
/
.
test
(
e
)
&&
(
e
=
e
.
replace
(
/^#
\/
/
,
""
),
o
.
href
=
"/"
+
e
,
e
=
e
.
replace
(
/
([^
#
])(
#.*$
)
/
,
"$1"
).
split
(
"/"
)
||
[],
this
.
each
(
e
,
function
(
e
,
t
){
/^
\
w
+=
/.test
(
t
)?(
t=t.split
(
"="
)
,o.search
[
t[0
]
]=t
[
1
])
:o.path.push
(
t
)
}
))
,o},n.prototype.url=function
(
e
)
{var r,t,o=this;return{pathname:
(
e
?((
e.match
(
/
\
.[
^
.]
+
?
\
/
.
+
/
)
||
[])[
0
]
||""
)
.replace
(
/
^
[
^
\
/
]
+
/,""
)
.replace
(
/
\
?.
+
/,""
)
:location.pathname
)
.replace
(
/
^
\
//,"").split("/"),search:(r={},t=(e?(e.match(/\?.+/)||[])[0]||"":location.search).replace(/^\?+/,"").split("&"),o.each(t,function(e,t){var o=t.indexOf("="),n=o<0?t.substr(0,t.length):0!==o&&t.substr(0,o);n&&(r[n]=0<o?t.substr(o+1):null)}),r),hash:o.router(e?(e.match(/#.+/)||[])[0]||"":location.hash)}},n.prototype.data=function(e,t,o){if(e=e||"layui",o=o||localStorage,r.JSON&&r.JSON.parse){if(null===t)return delete o[e];t="object"==typeof t?t:{key:t};try{var n=JSON.parse(o[e])}catch(e){n={}}return"value"in t&&(n[t.key]=t.value),t.remove&&delete n[t.key],o[e]=JSON.stringify(n),t.key?n[t.key]:n}},n.prototype.sessionData=function(e,t){return this.data(e,t,sessionStorage)},n.prototype.device=function(e){function t(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return(e=(o.match(t)||[])[1])||!1}var o=navigator.userAgent.toLowerCase(),n={os:/windows/.test(o)?"windows":/linux/.test(o)?"linux":/iphone|ipod|ipad|ios/.test(o)?"ios":/mac/.test(o)?"mac":void 0,ie:!!(r.ActiveXObject||"ActiveXObject"in r)&&((o.match(/msie\s(\d+)/)||[])[1]||"11"),weixin:t("micromessenger")};return e&&!n[e]&&(n[e]=t(e)),n.android=/android/.test(o),n.ios="ios"===n.os,n.mobile=!(!n.android&&!n.ios),n},n.prototype.hint=function(){return{error:d}},n.prototype.each=function(e,t){var o;if("function"!=typeof t)return this;if((e=e||[]).constructor===Object){for(o in e)if(t.call(e[o],o,e[o]))break}else for(o=0;o<e.length&&!t.call(e[o],o,e[o]);o++);return this},n.prototype.sort=function(e,a,t){var o=JSON.parse(JSON.stringify(e||[]));return a&&(o.sort(function(e,t){var o=/^-?\d+$/,n=e[a],r=t[a];return o.test(n)&&(n=parseFloat(n)),o.test(r)&&(r=parseFloat(r)),n&&!r?1:!n&&r?-1:r<n?1:n<r?-1:0}),t&&o.reverse()),o},n.prototype.stope=function(t){t=t||r.event;try{t.stopPropagation()}catch(e){t.cancelBubble=!0}},n.prototype.onevent=function(e,t,o){return"string"!=typeof e||"function"!=typeof o?this:n.event(e,t,null,o)},n.prototype.event=n.event=function(e,t,o,n){function r(e,t){!1===(t&&t.call(a,o))&&null===i&&(i=!1)}var a=this,i=null,l=t.match(/\((.*)\)$/)||[],u=(e+"."+t).replace(l[0],""),s=l[1]||"";return n?(m.event[u]=m.event[u]||{},m.event[u][s]=[n],this):(layui.each(m.event[u],function(e,t){return"{*}"===s?void layui.each(t,r):(""===e&&layui.each(t,r),void(s&&e===s&&layui.each(t,r)))}),i)},r.layui=new n}(window);
\ No newline at end of file
src/main/resources/static/js/layui/css/layui.main.css
0 → 100644
View file @
327439c0
This diff is collapsed.
Click to expand it.
src/main/resources/templates/groupBuy/addOrEdit.html
View file @
327439c0
This diff is collapsed.
Click to expand it.
src/main/resources/templates/groupBuy/list.html
View file @
327439c0
...
...
@@ -171,12 +171,27 @@
,
limits
:
[
10
,
20
,
50
,
100
]
//每页条数的选择项,默认:[10,20,30,40,50,60,70,80,90]。
,
cols
:
[
[
//{type: 'checkbox', field: 'goodsId', fixed: "left"}
{
type
:
'checkbox'
,
field
:
'id'
}
,
{
field
:
'
groupBuyCode
'
,
title
:
'编码'
}
,
{
field
:
'
id
'
,
title
:
'编码'
}
,
{
field
:
'groupBuyTitle'
,
title
:
'活动标题'
}
,
{
field
:
'startAndEndTime'
,
title
:
'活动日期'
}
,
{
field
:
'groupStatus'
,
title
:
'状态'
}
,
{
title
:
"状态"
,
width
:
100
,
templet
:
function
(
d
)
{
var
str
=
""
;
str
+=
'<div>'
;
//订单状态
var
status
=
""
;
if
(
d
.
groupStatus
==
3
)
status
=
"<span class='layui-badge layui-bg-orange'>生效中</span>"
;
if
(
d
.
groupStatus
==
4
)
status
=
"<span class='layui-badge layui-bg-orange'>已失效</span>"
;
str
+=
' <span>'
+
status
+
'</span>'
;
str
+=
'</div>'
;
return
str
?
str
:
""
;
}
}
// , {field: 'sicon', title: '图片', toolbar: '#sicon'}
,
{
field
:
''
,
width
:
100
,
title
:
'操作'
,
toolbar
:
'#table-handle'
,
fixed
:
'right'
}
]
...
...
src/main/resources/templates/groupBuy/productList.html
0 → 100644
View file @
327439c0
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
后台管理系统
</title>
<meta
name=
"renderer"
content=
"webkit"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
>
<link
rel=
"shortcut icon"
th:href=
"@{/images/logo.jpg}"
/>
<link
rel=
"stylesheet"
th:href=
"@{/js/layui/css/layui.css}"
>
<link
rel=
"stylesheet"
th:href=
"@{/js/layui/css/admin.css}"
>
<link
rel=
"stylesheet"
th:href=
"@{/js/upload_img/css/index.css}"
>
<script
type=
"text/javascript"
th:src=
"@{/js/jquery-3.3.1.min.js}"
></script>
<script
th:src=
"@{/js/layui/layui.js}"
charset=
"utf-8"
></script>
<script
th:src=
"@{/js/layui/layui.all.js}"
charset=
"utf-8"
></script>
<style>
</style>
</head>
<body>
<div
class=
"layui-form"
style=
"padding: 20px 0 0 0;"
>
<div
class=
"layui-card"
>
<div
class=
"layui-form layui-card-header layuiadmin-card-header-auto"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"sname"
class=
"layui-input"
placeholder=
"请输入商品名称"
>
</div>
</div>
<div
class=
"layui-inline"
>
<button
class=
"layui-btn layuiadmin-button-btn"
lay-submit
lay-filter=
"The-search"
>
<i
class=
"layui-icon layui-icon-search layuiadmin-button-btn"
>
</i>
</button>
</div>
<div
class=
"layui-inline"
>
<button
class=
"layui-btn layuiadmin-button-btn"
onclick=
"javascript:location.replace(location.href);"
>
<i
class=
"layui-icon layui-icon-refresh-3 layuiadmin-button-btn"
>
</i>
</button>
</div>
</div>
</div>
</div>
<div
class=
"layui-card-body"
>
<table
class=
"layui-hide"
id=
"tableId"
lay-filter=
"tableId"
></table>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-input-block"
>
<button
class=
"layui-btn"
id=
"btn-ok"
>
确定
</button>
<button
class=
"layui-btn layui-btn-primary"
id=
"btn-cancel"
>
取消
</button>
</div>
</div>
</div>
<!--<script type="text/javascript" th:src="@{/js/upload_img/js/updateimg.js}"></script>-->
<script>
var
field
;
layui
.
use
([
'table'
,
'form'
],
function
()
{
var
form
=
layui
.
form
,
table
=
layui
.
table
;
//监听搜索
form
.
on
(
'submit(The-search)'
,
function
(
data
)
{
field
=
data
.
field
;
//执行重载
table
.
reload
(
'tableId'
,
{
where
:
field
,
page
:
{
curr
:
1
}
});
});
table
.
render
({
elem
:
'#tableId'
,
url
:
'getProductList'
,
where
:
field
,
method
:
'post'
,
contentType
:
"application/json"
// 内容编码, json格式
,
height
:
350
,
defaultToolbar
:
[
'filter'
]
,
cellMinWidth
:
20
//全局定义常规单元格的最小宽度,layui 2.2.1 新增
,
skin
:
'line '
//表格风格 line (行边框风格)row (列边框风格)nob (无边框风格)
,
even
:
true
//隔行换色
,
limit
:
10
//每页默认显示的数量
,
page
:
true
,
request
:
{
pageName
:
"curpage"
,
// 页码的参数名称,默认:page
limitName
:
"pagesize"
// 每页数据量的参数名,默认:limit
}
,
response
:
{
statusName
:
"code"
,
// 规定数据状态的字段名称,默认:code
statusCode
:
100
,
// 规定成功的状态码,默认:0
msgName
:
"msg"
,
// 规定状态信息的字段名称,默认:msg
countName
:
"count"
,
// 规定数据总数的字段名称,默认:count
dataName
:
"data"
// 规定数据列表的字段名称,默认:data
}
,
parseData
:
function
(
res
)
{
// res 即为原始返回的数据
return
{
"code"
:
res
.
code
,
// 解析接口状态
"msg"
:
res
.
msg
,
// 解析提示文本
"count"
:
res
.
data
.
pageinfo
.
totalRecords
,
// 解析数据长度
"data"
:
res
.
data
.
items
// 解析数据列表
};
}
,
limits
:
[
10
,
20
,
50
,
100
]
//每页条数的选择项,默认:[10,20,30,40,50,60,70,80,90]。
,
cols
:
[
[
{
type
:
'checkbox'
,
field
:
'id'
},
{
field
:
'id'
,
title
:
'编码'
},
{
field
:
'sshortpic'
,
title
:
'头图'
},
{
field
:
'sname'
,
title
:
'名称'
},
{
field
:
'catalogName'
,
title
:
'分类'
},
{
field
:
'doldprice'
,
title
:
'原价'
},
{
field
:
'dsaleprice'
,
title
:
'售价'
},
]
]
});
var
selectedData
=
[];
// 保存选中的数据
$
(
'#btn-ok'
).
on
(
'click'
,
function
()
{
table
.
checkStatus
(
'tableId'
).
data
.
forEach
(
function
(
item
){
selectedData
.
push
(
item
);
});
// 获取父页面的 window 对象
var
parentWindow
=
window
.
parent
;
// 使用 postMessage 发送数据到父页面
parentWindow
.
postMessage
(
selectedData
,
'*'
);
// parent.layui.trigger('selectedData', selectedData);
parent
.
layer
.
close
(
parent
.
layer
.
getFrameIndex
(
window
.
name
));
});
$
(
'#btn-cancel'
).
on
(
'click'
,
function
()
{
parent
.
layer
.
close
(
parent
.
layer
.
getFrameIndex
(
window
.
name
));
});
});
</script>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment