update sources
Signed-off-by: Puqns67 <me@puqns67.icu>
This commit is contained in:
parent
c65dfd1f2c
commit
92fb9f4f5b
@ -14,7 +14,7 @@ import team8.fruitable.datebase.repository.AccountRepository
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/action/account")
|
||||
class Account(private val repository: AccountRepository) {
|
||||
class AccountAction(private val repository: AccountRepository) {
|
||||
private fun getCurrentUser(token: String?): User? {
|
||||
return token?.let(repository::findByToken)
|
||||
}
|
@ -15,7 +15,7 @@ import team8.fruitable.datebase.repository.ItemRepository
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/action/cart")
|
||||
class Cart(
|
||||
class CartAction(
|
||||
private val cartRepository: CartRepository,
|
||||
private val accountRepository: AccountRepository,
|
||||
private val itemRepository: ItemRepository
|
||||
@ -33,13 +33,13 @@ class Cart(
|
||||
): String {
|
||||
val user = this.getCurrentUser(token) ?: return error(attributes, "添加商品至购物车", "未登录账户", "/login")
|
||||
val item = itemRepository.findById(id)
|
||||
.orElse(null) ?: return error(attributes, "添加商品至购物车", "商品不存在", "/cart")
|
||||
.orElse(null) ?: return error(attributes, "添加商品至购物车", "商品不存在", "/items")
|
||||
cartRepository.save(
|
||||
cartRepository.findByUserAndItem(user, item)?.let {
|
||||
it.number += 1; it
|
||||
} ?: CartedItem(user, item))
|
||||
redirect?.let { return "redirect:/${it}" }
|
||||
return "redirect:/items"
|
||||
return "redirect:/cart"
|
||||
}
|
||||
|
||||
@RequestMapping("/add/{id}/{number}")
|
@ -14,7 +14,7 @@ import team8.fruitable.datebase.repository.*
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/action/order")
|
||||
class Order(
|
||||
class OrderAction(
|
||||
private val orderRepository: OrderRepository,
|
||||
private val orderedItemRepository: OrderedItemRepository,
|
||||
private val payTypeRepository: PayTypeRepository,
|
||||
@ -61,7 +61,7 @@ class Order(
|
||||
attributes: RedirectAttributes,
|
||||
@CookieValue("TOKEN", required = false) token: String?,
|
||||
@RequestParam("items") itemIds: Array<Long>,
|
||||
@RequestParam("item_numbers") itemNumbers: Array<Int>,
|
||||
@RequestParam("numbers") itemNumbers: Array<Int>,
|
||||
@RequestParam("name") name: String,
|
||||
@RequestParam("phone") phone: String,
|
||||
@RequestParam("address") address: String,
|
@ -20,7 +20,7 @@ import kotlin.io.path.exists
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/action/edit/item")
|
||||
class Item(
|
||||
class ItemEditorAction(
|
||||
private val accountRepository: AccountRepository,
|
||||
private val itemRepository: ItemRepository,
|
||||
private val tagRepository: TagRepository
|
@ -11,7 +11,7 @@ import team8.fruitable.datebase.repository.AccountRepository
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/action/edit/user")
|
||||
class User(private val accountRepository: AccountRepository) {
|
||||
class UserEditorAction(private val accountRepository: AccountRepository) {
|
||||
private fun getCurrentUser(token: String?): User? {
|
||||
return token?.let(accountRepository::findByToken)
|
||||
}
|
||||
@ -93,7 +93,7 @@ class User(private val accountRepository: AccountRepository) {
|
||||
attributes, "禁用账户", "未找到此账户", "/editor?use=user"
|
||||
)
|
||||
user.revoke()
|
||||
accountRepository.delete(user)
|
||||
accountRepository.save(user)
|
||||
redirect?.let { return "redirect:/${it}" }
|
||||
return "redirect:/editor?use=user"
|
||||
}
|
@ -17,7 +17,7 @@ import team8.fruitable.datebase.repository.PagebleItemRepository
|
||||
|
||||
|
||||
@Controller
|
||||
class Editor(
|
||||
class EditorPage(
|
||||
private val accountRepository: AccountRepository,
|
||||
private val itemRepository: ItemRepository,
|
||||
private val pagingAccountRepository: PagebleAccountRepository,
|
||||
@ -108,7 +108,7 @@ class Editor(
|
||||
"revoking" -> model["isRevoking"] = true
|
||||
else -> model["isNothing"] = true
|
||||
}
|
||||
if (action == "updating" || action == "deleting") {
|
||||
if (action == "updating" || action == "revoking") {
|
||||
model["target"] = when (use) {
|
||||
"item" -> {
|
||||
target?.let {
|
@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping
|
||||
import team8.fruitable.datebase.repository.AccountRepository
|
||||
|
||||
@Controller
|
||||
class Error(private val repository: AccountRepository) : ErrorController {
|
||||
class ErrorPage(private val repository: AccountRepository) : ErrorController {
|
||||
@RequestMapping("/error")
|
||||
fun error(
|
||||
model: Model,
|
63
src/main/kotlin/team8/fruitable/controller/page/OrderPage.kt
Normal file
63
src/main/kotlin/team8/fruitable/controller/page/OrderPage.kt
Normal file
@ -0,0 +1,63 @@
|
||||
package team8.fruitable.controller.page
|
||||
|
||||
import org.springframework.stereotype.Controller
|
||||
import org.springframework.ui.Model
|
||||
import org.springframework.ui.set
|
||||
import org.springframework.web.bind.annotation.CookieValue
|
||||
import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RequestParam
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes
|
||||
import team8.fruitable.controller.util.error
|
||||
import team8.fruitable.datebase.entity.User
|
||||
import team8.fruitable.datebase.repository.AccountRepository
|
||||
import team8.fruitable.datebase.repository.ItemRepository
|
||||
import team8.fruitable.datebase.repository.OrderRepository
|
||||
|
||||
@Controller
|
||||
class OrderPage(
|
||||
private val orderRepository: OrderRepository,
|
||||
private val accountRepository: AccountRepository,
|
||||
private val itemRepository: ItemRepository
|
||||
) {
|
||||
private fun getCurrentUser(token: String?): User? {
|
||||
return token?.let(accountRepository::findByToken)
|
||||
}
|
||||
|
||||
@RequestMapping("/orders")
|
||||
fun orders(
|
||||
model: Model, attributes: RedirectAttributes, @CookieValue("TOKEN", required = false) token: String?
|
||||
): String {
|
||||
model["isOrder"] = true
|
||||
val user = this.getCurrentUser(token) ?: return error(attributes, "查看订单列表", "账户未登录", "/login")
|
||||
model["user"] = user
|
||||
return "orders"
|
||||
}
|
||||
|
||||
@RequestMapping("/order/create")
|
||||
fun create(
|
||||
model: Model,
|
||||
attributes: RedirectAttributes,
|
||||
@CookieValue("TOKEN", required = false) token: String?,
|
||||
@RequestParam("id") id: Array<Long>
|
||||
): String {
|
||||
val user = this.getCurrentUser(token) ?: return error(attributes, "更新", "账户未登录", "/login")
|
||||
model["user"] = user
|
||||
return "order/create"
|
||||
}
|
||||
|
||||
@RequestMapping("/order/create/{id}")
|
||||
fun info(
|
||||
model: Model,
|
||||
attributes: RedirectAttributes,
|
||||
@CookieValue("TOKEN", required = false) token: String?,
|
||||
@PathVariable("id") id: Long,
|
||||
@RequestParam("number") number: Int?
|
||||
): String {
|
||||
val user = this.getCurrentUser(token) ?: return error(attributes, "查看订单", "账户未登录", "/login")
|
||||
val item = itemRepository.findById(id).orElse(null) ?: return error(attributes, "查看订单", "商品不存在")
|
||||
model["items"] = arrayOf(Triple(item, number ?: 1, item.price!! * (number ?: 1)))
|
||||
model["user"] = user
|
||||
return "order/create"
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package team8.fruitable.controller.page
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.stereotype.Controller
|
||||
import org.springframework.ui.Model
|
||||
import org.springframework.ui.set
|
||||
@ -15,9 +14,6 @@ import team8.fruitable.datebase.repository.ItemRepository
|
||||
|
||||
@Controller
|
||||
class Pages(private val accountRepository: AccountRepository, private val itemRepository: ItemRepository) {
|
||||
@Value("\${data.handler}")
|
||||
lateinit var handler: String
|
||||
|
||||
private fun getCurrentUser(token: String?): User? {
|
||||
return token?.let(accountRepository::findByToken)
|
||||
}
|
||||
@ -90,8 +86,18 @@ class Pages(private val accountRepository: AccountRepository, private val itemRe
|
||||
this.getCurrentUser(token)?.let { model["user"] = it }
|
||||
val item = itemRepository.findById(id).orElse(null) ?: return error(attributes, "查看商品", "不存在的商品")
|
||||
model["item"] = item
|
||||
model["itemPicture"] =
|
||||
item.picture?.let { "${handler}/picture/${it.slice(0..1)}/${it}" } ?: "/images/placeholder.png"
|
||||
return "item"
|
||||
}
|
||||
|
||||
@RequestMapping("/cart")
|
||||
fun cart(
|
||||
model: Model,
|
||||
attributes: RedirectAttributes,
|
||||
@CookieValue("TOKEN", required = false) token: String?
|
||||
): String {
|
||||
model["isCart"] = true
|
||||
val user = this.getCurrentUser(token) ?: return error(attributes, "更新", "账户未登录", "/login")
|
||||
model["user"] = user
|
||||
return "cart"
|
||||
}
|
||||
}
|
||||
|
@ -106,4 +106,9 @@ class Item(
|
||||
fun getTagString(): String {
|
||||
return this.tags.joinToString(" ")
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun getPictureLink(): String {
|
||||
return this.picture?.let { "/resourcesNew/picture/${it.slice(0..1)}/${it}" } ?: "/images/placeholder.png"
|
||||
}
|
||||
}
|
||||
|
41
src/main/resources/static/styles/base.less
Normal file
41
src/main/resources/static/styles/base.less
Normal file
@ -0,0 +1,41 @@
|
||||
@font-face {
|
||||
font-family: "Normal";
|
||||
src: url("../fonts/华文圆体-Regular.ttf") format("ttf");
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
margin: auto;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
div {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#Contents {
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.TabForm {
|
||||
margin: 5px;
|
||||
padding: 26px 48px;
|
||||
background-color: rgba(0, 60, 130, 0.8);
|
||||
border: 3px solid rgba(0, 120, 255, 0.8);
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.TabTitle, .TabFormItem > .ItemName {
|
||||
color: wheat;
|
||||
font-family: "Normal", system-ui;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
#Contents {
|
||||
width: 640px;
|
||||
}
|
||||
}
|
@ -68,51 +68,28 @@ div {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
> .Options {
|
||||
flex-direction: column;
|
||||
> .Number {
|
||||
flex-direction: row;
|
||||
justify-content: space-evenly;
|
||||
|
||||
> .Option {
|
||||
flex-direction: row;
|
||||
margin: 5px 0;
|
||||
border: 1px solid rgba(0, 120, 255, 0.8);
|
||||
border-radius: 5px;
|
||||
|
||||
> .Title {
|
||||
font-weight: bold;
|
||||
padding: 0 10px;
|
||||
border-radius: 5px 0 0 5px;
|
||||
background: green;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
> .Contents {
|
||||
flex-wrap: wrap;
|
||||
align-items: stretch;
|
||||
|
||||
> .Option {
|
||||
font-size: 18px;
|
||||
padding: 0 5px;
|
||||
align-items: center;
|
||||
background-color: #355ae8;
|
||||
}
|
||||
|
||||
.Option[selected] {
|
||||
font-weight: bold;
|
||||
background-color: #489dff;
|
||||
}
|
||||
}
|
||||
> .Input {
|
||||
margin-left: 20px;
|
||||
border-radius: 10px;
|
||||
border: 3px solid skyblue;
|
||||
}
|
||||
}
|
||||
|
||||
> .Buttons {
|
||||
justify-content: space-evenly;
|
||||
text-align: center;
|
||||
justify-content: space-evenly;
|
||||
|
||||
> .Button {
|
||||
width: 90px;
|
||||
padding: 10px 30px;
|
||||
border-radius: 15px;
|
||||
background-color: darkgreen;
|
||||
flex: 1;
|
||||
padding: 8px 30px;
|
||||
border: 3px solid skyblue;
|
||||
border-radius: 10px;
|
||||
background-color: cadetblue;
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
|
0
src/main/resources/static/styles/order.less
Normal file
0
src/main/resources/static/styles/order.less
Normal file
0
src/main/resources/static/styles/orders.less
Normal file
0
src/main/resources/static/styles/orders.less
Normal file
@ -1,41 +0,0 @@
|
||||
@font-face {
|
||||
font-family: "Normal";
|
||||
src: url("../fonts/华文圆体-Regular.ttf") format("ttf");
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
margin: auto;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
div {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#Contents {
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.TabForm {
|
||||
margin: 5px;
|
||||
padding: 26px 48px;
|
||||
background-color: rgba(0, 60, 130, 0.8);
|
||||
border: 3px solid rgba(0, 120, 255, 0.8);
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.TabTitle, .TabFormItem > .ItemName {
|
||||
color: wheat;
|
||||
font-family: "Normal";
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
#Contents {
|
||||
width: 640px;
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
<link type="text/css" rel="stylesheet" href="/styles/top.css">
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/form.less">
|
||||
<!-- 页面特定的样式表 -->
|
||||
<link type="text/css" rel="stylesheet" href="/styles/user.css">
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/base.less">
|
||||
<!-- 外部小组件 -->
|
||||
<script src="/scripts/lib/less.min.js"></script>
|
||||
<script src="/scripts/lib/anime.min.js"></script>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html lang="zh-Hans">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>编辑 - 在线果蔬商城</title>
|
||||
<title>我的购物车 - 在线果蔬商城</title>
|
||||
<script type="text/javascript" src="/scripts/header.js"></script>
|
||||
<script type="text/javascript" src="/scripts/clock.js"></script>
|
||||
<script type="text/javascript" src="/scripts/top.js"></script>
|
||||
@ -11,9 +11,8 @@
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/header.less">
|
||||
<link type="text/css" rel="stylesheet" href="/styles/clock.css">
|
||||
<link type="text/css" rel="stylesheet" href="/styles/top.css">
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/form.less">
|
||||
<!-- 页面特定的样式表 -->
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/edit.less">
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/cart.less">
|
||||
<!-- 外部小组件 -->
|
||||
<script src="/scripts/lib/less.min.js"></script>
|
||||
<script src="/scripts/lib/anime.min.js"></script>
|
||||
|
@ -8,6 +8,7 @@
|
||||
<td>更新时间</td>
|
||||
<td>价格</td>
|
||||
<td>标签</td>
|
||||
<td>已撤销</td>
|
||||
<td>操作</td>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -20,6 +21,7 @@
|
||||
<td>{{editTime}}</td>
|
||||
<td>{{price}}</td>
|
||||
<td>{{tagPretty}}</td>
|
||||
<td>{{#isRevoked}}是{{/isRevoked}}{{^isRevoked}}否{{/isRevoked}}</td>
|
||||
<td>
|
||||
<button class="update">编辑</button>
|
||||
<button class="revoke">撤销</button>
|
||||
@ -124,9 +126,9 @@
|
||||
{{/isUpdating}}
|
||||
|
||||
{{#isRevoking}}
|
||||
<form class="TabForm" action="/action/edit/item/delete/{{target.id}}" method="post">
|
||||
<h2>确定要删除商品 {{target.name}} 吗?</h2>
|
||||
<button class="TabButton" type="submit">删除</button>
|
||||
<form class="TabForm" action="/action/edit/item/revoke/{{target.id}}" method="post">
|
||||
<h2>确定要撤销商品 {{target.name}} 吗?</h2>
|
||||
<button class="TabButton" type="submit">撤销</button>
|
||||
</form>
|
||||
{{/isRevoking}}
|
||||
</div>
|
||||
|
@ -12,6 +12,7 @@
|
||||
<td>邮箱</td>
|
||||
<td>地址</td>
|
||||
<td>管理员</td>
|
||||
<td>已禁用</td>
|
||||
<td>操作</td>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -28,6 +29,7 @@
|
||||
<td>{{#email}}{{email}}{{/email}}</td>
|
||||
<td>{{#address}}{{address}}{{/address}}</td>
|
||||
<td>{{#isAdmin}}是{{/isAdmin}}{{^isAdmin}}否{{/isAdmin}}</td>
|
||||
<td>{{#isRevoked}}是{{/isRevoked}}{{^isRevoked}}否{{/isRevoked}}</td>
|
||||
<td>
|
||||
<button class="update">编辑</button>
|
||||
<button class="revoke">禁用</button>
|
||||
@ -185,9 +187,9 @@
|
||||
{{/isUpdating}}
|
||||
|
||||
{{#isRevoking}}
|
||||
<form class="TabForm" action="/action/edit/user/delete/{{target.id}}" method="post">
|
||||
<h2>确定要删除用户 {{target.name}} 吗?</h2>
|
||||
<button class="TabButton" type="submit">删除</button>
|
||||
<form class="TabForm" action="/action/edit/user/revoke/{{target.id}}" method="post">
|
||||
<h2>确定要禁用用户 {{target.name}} 吗?</h2>
|
||||
<button class="TabButton" type="submit">禁用</button>
|
||||
</form>
|
||||
{{/isRevoking}}
|
||||
</div>
|
||||
|
@ -15,7 +15,11 @@
|
||||
</div>
|
||||
<div class="List Blank"></div>
|
||||
{{#user}}
|
||||
<div class="List Button Link" {{#isCart}}this{{/isCart}}{{^isCart}}href="/cart"{{/isCart}}><span class="Text">购物车</span>
|
||||
<div class="List Button Link" {{#isOrder}}this{{/isOrder}}{{^isOrder}}href="/orders"{{/isOrder}}>
|
||||
<span class="Text">订单</span>
|
||||
</div>
|
||||
<div class="List Button Link" {{#isCart}}this{{/isCart}}{{^isCart}}href="/cart"{{/isCart}}>
|
||||
<span class="Text">购物车</span>
|
||||
</div>
|
||||
<div class="List Button Link" href="/action/account/logout"><span class="Text">注销</span></div>
|
||||
{{#isAdmin}}
|
||||
|
@ -26,9 +26,9 @@
|
||||
|
||||
<!-- 页面内容 -->
|
||||
<div id="Contents">
|
||||
<form class="Item" {{#item.isRevoked}}revoked{{/item.isRevoked}}>
|
||||
<form class="Item" action="/order/create/{{item.id}}" {{#item.isRevoked}}revoked{{/item.isRevoked}}>
|
||||
<div class="Picture">
|
||||
<img alt="商品图片" src="{{itemPicture}}"/>
|
||||
<img alt="商品图片" src="{{item.pictureLink}}"/>
|
||||
</div>
|
||||
<div class="Infos">
|
||||
<span class="Title">{{item.name}}</span>
|
||||
@ -48,24 +48,14 @@
|
||||
<div class="Tag">{{name}}</div>
|
||||
{{/item.tags}}
|
||||
</div>
|
||||
<div class="Options">
|
||||
<div class="Option">
|
||||
<div class="Title">数量</div>
|
||||
<div class="Contents">
|
||||
<div class="Option" value="1" selected> 1 </div>
|
||||
<div class="Option" value="2"> 2 </div>
|
||||
<div class="Option" value="3"> 3 </div>
|
||||
<div class="Option" value="4"> 4 </div>
|
||||
<div class="Option" value="5"> 5 </div>
|
||||
<div class="Option" value="6"> 6 </div>
|
||||
<div class="Option" value="7"> 7 </div>
|
||||
<div class="Option" value="8"> 8 </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Number">
|
||||
<label class="Title" for="number">数量</label>
|
||||
<input class="Input" id="number" type="number" name="number" value="1"
|
||||
min="1" max="99" required {{#item.isRevoked}}disabled{{/item.isRevoked}}/>
|
||||
</div>
|
||||
<div class="Buttons">
|
||||
<span class="Button">加入购物车</span>
|
||||
<span class="Button">立即购买</span>
|
||||
<button class="Button" type="button" onclick="window.location.replace('/action/cart/add/{{item.id}}')">加入购物车</button>
|
||||
<button class="Button" type="submit" {{#item.isRevoked}}disabled{{/item.isRevoked}}>立即购买</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -13,7 +13,7 @@
|
||||
<link type="text/css" rel="stylesheet" href="/styles/top.css">
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/form.less">
|
||||
<!-- 页面特定的样式表 -->
|
||||
<link type="text/css" rel="stylesheet" href="/styles/user.css">
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/base.less">
|
||||
<!-- 外部小组件 -->
|
||||
<script src="/scripts/lib/less.min.js"></script>
|
||||
<script src="/scripts/lib/anime.min.js"></script>
|
||||
|
100
src/main/resources/templates/order/create.mustache
Normal file
100
src/main/resources/templates/order/create.mustache
Normal file
@ -0,0 +1,100 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-Hans">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>订单 - 在线果蔬商城</title>
|
||||
<script type="text/javascript" src="/scripts/header.js"></script>
|
||||
<script type="text/javascript" src="/scripts/clock.js"></script>
|
||||
<script type="text/javascript" src="/scripts/top.js"></script>
|
||||
<link type="image/x-icon" rel="icon" href="/images/favicon.ico">
|
||||
<!-- 页面公共的样式表 -->
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/header.less">
|
||||
<link type="text/css" rel="stylesheet" href="/styles/clock.css">
|
||||
<link type="text/css" rel="stylesheet" href="/styles/top.css">
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/form.less">
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/base.less">
|
||||
<!-- 页面特定的样式表 -->
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/order.less">
|
||||
<!-- 外部小组件 -->
|
||||
<script src="/scripts/lib/less.min.js"></script>
|
||||
<script src="/scripts/lib/anime.min.js"></script>
|
||||
<script async src="/scripts/lib/explosion.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
{{>header}}
|
||||
|
||||
<!-- 页面内容 -->
|
||||
<div id="Contents">
|
||||
<form class="TabForm" action="/action/order/create" method="post">
|
||||
<div class="TabTitle">确认订单</div>
|
||||
|
||||
<div class="TabFormItems Infos">
|
||||
<div class="TabFormItem">
|
||||
<label class="ItemName" for="name">姓名</label>
|
||||
<input class="ItemInput" id="name" type="text" name="name" placeholder="请输入收货人姓名"
|
||||
{{#user.name}}value="{{user.name}}"{{/user.name}} required/>
|
||||
</div>
|
||||
|
||||
<div class="TabFormItem">
|
||||
<label class="ItemName" for="phone">手机号码</label>
|
||||
<input class="ItemInput" id="phone" type="tel" name="phone" placeholder="请输入收货人手机号码"
|
||||
{{#user.phone}}value="{{user.phone}}"{{/user.phone}} required/>
|
||||
</div>
|
||||
|
||||
<div class="TabFormItem">
|
||||
<label class="ItemName" for="address">地址</label>
|
||||
<input class="ItemInput" id="address" type="text" name="address" placeholder="请输入收货人地址"
|
||||
{{#user.address}}value="{{user.address}}"{{/user.address}} required/>
|
||||
</div>
|
||||
|
||||
<div class="TabFormItem">
|
||||
<input class="ItemInput" id="pay_type_card" type="radio" name="pay_type" value="1" checked/>
|
||||
<label class="ItemName" for="pay_type_card">银行卡</label>
|
||||
<input class="ItemInput" id="pay_type_wechat_pay" type="radio" name="pay_type" value="2"/>
|
||||
<label class="ItemName" for="pay_type_wechat_pay">微信支付</label>
|
||||
<input class="ItemInput" id="pay_type_alipay" type="radio" name="pay_type" value="3"/>
|
||||
<label class="ItemName" for="pay_type_alipay">支付宝</label>
|
||||
<input class="ItemInput" id="pay_type_union_pay" type="radio" name="pay_type" value="4"/>
|
||||
<label class="ItemName" for="pay_type_union_pay">云闪付</label>
|
||||
<input class="ItemInput" id="pay_type_paypal" type="radio" name="pay_type" value="5"/>
|
||||
<label class="ItemName" for="pay_type_paypal">PayPal</label>
|
||||
<input class="ItemInput" id="pay_type_google_pay" type="radio" name="pay_type" value="6"/>
|
||||
<label class="ItemName" for="pay_type_google_pay">Google Pay</label>
|
||||
<input class="ItemInput" id="pay_type_apple_pay" type="radio" name="pay_type" value="7"/>
|
||||
<label class="ItemName" for="pay_type_apple_pay">Apple Pay</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="TabFormItems Items">
|
||||
{{#items}}
|
||||
<div class="TabFormItem Item" id="0">
|
||||
<input type="hidden" name="items" value="{{first.id}}"/>
|
||||
<input type="hidden" name="numbers" value="{{second}}"/>
|
||||
<div class="Picture">
|
||||
<img alt="商品图片" src="{{first.pictureLink}}">
|
||||
</div>
|
||||
<div class="infos">
|
||||
<div class="Info">
|
||||
<span class="Title">{{first.name}}</span>
|
||||
<span class="Prices">
|
||||
<span class="Price">¥${{first.price}}</span>
|
||||
<span class="Number">x{{second}}</span>
|
||||
<span class="PriceSum">¥${{third}}</span>
|
||||
</span>
|
||||
</div>
|
||||
<span class="Description">{{first.description}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{/items}}
|
||||
</div>
|
||||
|
||||
<div class="TabButtons">
|
||||
<button class="TabButton" type="submit">创建订单</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
81
src/main/resources/templates/order/update.mustache
Normal file
81
src/main/resources/templates/order/update.mustache
Normal file
@ -0,0 +1,81 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-Hans">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>订单 - 在线果蔬商城</title>
|
||||
<script type="text/javascript" src="/scripts/header.js"></script>
|
||||
<script type="text/javascript" src="/scripts/clock.js"></script>
|
||||
<script type="text/javascript" src="/scripts/top.js"></script>
|
||||
<link type="image/x-icon" rel="icon" href="/images/favicon.ico">
|
||||
<!-- 页面公共的样式表 -->
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/header.less">
|
||||
<link type="text/css" rel="stylesheet" href="/styles/clock.css">
|
||||
<link type="text/css" rel="stylesheet" href="/styles/top.css">
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/form.less">
|
||||
<!-- 页面特定的样式表 -->
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/order.less">
|
||||
<!-- 外部小组件 -->
|
||||
<script src="/scripts/lib/less.min.js"></script>
|
||||
<script src="/scripts/lib/anime.min.js"></script>
|
||||
<script async src="/scripts/lib/explosion.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
{{>header}}
|
||||
|
||||
<!-- 页面内容 -->
|
||||
<div id="Contents">
|
||||
<form class="TabForm" action="/action/order/update/{{order.id}}" method="post">
|
||||
<div class="TabTitle">订单</div>
|
||||
|
||||
<div class="TabFormItems Infos">
|
||||
<div class="TabFormItem">
|
||||
<label class="ItemName" for="name">姓名</label>
|
||||
<input class="ItemInput" id="name" type="text" name="name" placeholder="请输入收货人姓名"
|
||||
{{#order.name}}value="{{order.name}}"{{/order.name}} required/>
|
||||
</div>
|
||||
|
||||
<div class="TabFormItem">
|
||||
<label class="ItemName" for="address">地址</label>
|
||||
<input class="ItemInput" id="address" type="text" name="address" placeholder="请输入收货人地址"
|
||||
{{#order.address}}value="{{order.address}}"{{/order.address}} required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="TabButtons">
|
||||
<button class="TabButton" type="button"
|
||||
onclick="window.location.replace('/action/order/revoke/{{order.id}}')">撤销订单
|
||||
</button>
|
||||
<button class="TabButton" type="button"
|
||||
onclick="window.location.replace('/action/order/paid/{{order.id}}')">已支付订单
|
||||
</button>
|
||||
<button class="TabButton" type="submit">更新订单信息</button>
|
||||
</div>
|
||||
|
||||
<div class="TabFormItems Items">
|
||||
{{#items}}
|
||||
<div class="Item" id="0">
|
||||
<div class="Picture">
|
||||
<img alt="商品图片" src="{{a.pictureLink}}">
|
||||
</div>
|
||||
|
||||
<div class="infos">
|
||||
<div class="Info">
|
||||
<span class="Title">{{a.name}}</span>
|
||||
<span class="Prices">
|
||||
<span class="Price">¥${{a.price}}</span>
|
||||
<span class="Number">x{{b}}</span>
|
||||
<span class="PriceSum">¥${{c}}</span>
|
||||
</span>
|
||||
</div>
|
||||
<span class="Description">{{a.description}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{/items}}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
31
src/main/resources/templates/orders.mustache
Normal file
31
src/main/resources/templates/orders.mustache
Normal file
@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-Hans">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>我的订单 - 在线果蔬商城</title>
|
||||
<script type="text/javascript" src="/scripts/header.js"></script>
|
||||
<script type="text/javascript" src="/scripts/clock.js"></script>
|
||||
<script type="text/javascript" src="/scripts/top.js"></script>
|
||||
<link type="image/x-icon" rel="icon" href="/images/favicon.ico">
|
||||
<!-- 页面公共的样式表 -->
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/header.less">
|
||||
<link type="text/css" rel="stylesheet" href="/styles/clock.css">
|
||||
<link type="text/css" rel="stylesheet" href="/styles/top.css">
|
||||
<!-- 页面特定的样式表 -->
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/orders.less">
|
||||
<!-- 外部小组件 -->
|
||||
<script src="/scripts/lib/less.min.js"></script>
|
||||
<script src="/scripts/lib/anime.min.js"></script>
|
||||
<script async src="/scripts/lib/explosion.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
{{>header}}
|
||||
|
||||
<!-- 页面内容 -->
|
||||
<div id="Contents">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -13,7 +13,7 @@
|
||||
<link type="text/css" rel="stylesheet" href="/styles/top.css">
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/form.less">
|
||||
<!-- 页面特定的样式表 -->
|
||||
<link type="text/css" rel="stylesheet" href="/styles/user.css">
|
||||
<link type="text/css" rel="stylesheet/less" href="/styles/base.less">
|
||||
<!-- 外部小组件 -->
|
||||
<script src="/scripts/lib/less.min.js"></script>
|
||||
<script src="/scripts/lib/anime.min.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user