update sources

Signed-off-by: Puqns67 <me@puqns67.icu>
This commit is contained in:
Puqns67 2023-09-19 01:21:49 +08:00
parent c65dfd1f2c
commit 92fb9f4f5b
Signed by: Puqns67
GPG Key ID: 9669DF042554F536
26 changed files with 387 additions and 127 deletions

View File

@ -14,7 +14,7 @@ import team8.fruitable.datebase.repository.AccountRepository
@Controller @Controller
@RequestMapping("/action/account") @RequestMapping("/action/account")
class Account(private val repository: AccountRepository) { class AccountAction(private val repository: AccountRepository) {
private fun getCurrentUser(token: String?): User? { private fun getCurrentUser(token: String?): User? {
return token?.let(repository::findByToken) return token?.let(repository::findByToken)
} }

View File

@ -15,7 +15,7 @@ import team8.fruitable.datebase.repository.ItemRepository
@Controller @Controller
@RequestMapping("/action/cart") @RequestMapping("/action/cart")
class Cart( class CartAction(
private val cartRepository: CartRepository, private val cartRepository: CartRepository,
private val accountRepository: AccountRepository, private val accountRepository: AccountRepository,
private val itemRepository: ItemRepository private val itemRepository: ItemRepository
@ -33,13 +33,13 @@ class Cart(
): String { ): String {
val user = this.getCurrentUser(token) ?: return error(attributes, "添加商品至购物车", "未登录账户", "/login") val user = this.getCurrentUser(token) ?: return error(attributes, "添加商品至购物车", "未登录账户", "/login")
val item = itemRepository.findById(id) val item = itemRepository.findById(id)
.orElse(null) ?: return error(attributes, "添加商品至购物车", "商品不存在", "/cart") .orElse(null) ?: return error(attributes, "添加商品至购物车", "商品不存在", "/items")
cartRepository.save( cartRepository.save(
cartRepository.findByUserAndItem(user, item)?.let { cartRepository.findByUserAndItem(user, item)?.let {
it.number += 1; it it.number += 1; it
} ?: CartedItem(user, item)) } ?: CartedItem(user, item))
redirect?.let { return "redirect:/${it}" } redirect?.let { return "redirect:/${it}" }
return "redirect:/items" return "redirect:/cart"
} }
@RequestMapping("/add/{id}/{number}") @RequestMapping("/add/{id}/{number}")

View File

@ -14,7 +14,7 @@ import team8.fruitable.datebase.repository.*
@Controller @Controller
@RequestMapping("/action/order") @RequestMapping("/action/order")
class Order( class OrderAction(
private val orderRepository: OrderRepository, private val orderRepository: OrderRepository,
private val orderedItemRepository: OrderedItemRepository, private val orderedItemRepository: OrderedItemRepository,
private val payTypeRepository: PayTypeRepository, private val payTypeRepository: PayTypeRepository,
@ -61,7 +61,7 @@ class Order(
attributes: RedirectAttributes, attributes: RedirectAttributes,
@CookieValue("TOKEN", required = false) token: String?, @CookieValue("TOKEN", required = false) token: String?,
@RequestParam("items") itemIds: Array<Long>, @RequestParam("items") itemIds: Array<Long>,
@RequestParam("item_numbers") itemNumbers: Array<Int>, @RequestParam("numbers") itemNumbers: Array<Int>,
@RequestParam("name") name: String, @RequestParam("name") name: String,
@RequestParam("phone") phone: String, @RequestParam("phone") phone: String,
@RequestParam("address") address: String, @RequestParam("address") address: String,

View File

@ -20,7 +20,7 @@ import kotlin.io.path.exists
@Controller @Controller
@RequestMapping("/action/edit/item") @RequestMapping("/action/edit/item")
class Item( class ItemEditorAction(
private val accountRepository: AccountRepository, private val accountRepository: AccountRepository,
private val itemRepository: ItemRepository, private val itemRepository: ItemRepository,
private val tagRepository: TagRepository private val tagRepository: TagRepository

View File

@ -11,7 +11,7 @@ import team8.fruitable.datebase.repository.AccountRepository
@Controller @Controller
@RequestMapping("/action/edit/user") @RequestMapping("/action/edit/user")
class User(private val accountRepository: AccountRepository) { class UserEditorAction(private val accountRepository: AccountRepository) {
private fun getCurrentUser(token: String?): User? { private fun getCurrentUser(token: String?): User? {
return token?.let(accountRepository::findByToken) return token?.let(accountRepository::findByToken)
} }
@ -93,7 +93,7 @@ class User(private val accountRepository: AccountRepository) {
attributes, "禁用账户", "未找到此账户", "/editor?use=user" attributes, "禁用账户", "未找到此账户", "/editor?use=user"
) )
user.revoke() user.revoke()
accountRepository.delete(user) accountRepository.save(user)
redirect?.let { return "redirect:/${it}" } redirect?.let { return "redirect:/${it}" }
return "redirect:/editor?use=user" return "redirect:/editor?use=user"
} }

View File

@ -17,7 +17,7 @@ import team8.fruitable.datebase.repository.PagebleItemRepository
@Controller @Controller
class Editor( class EditorPage(
private val accountRepository: AccountRepository, private val accountRepository: AccountRepository,
private val itemRepository: ItemRepository, private val itemRepository: ItemRepository,
private val pagingAccountRepository: PagebleAccountRepository, private val pagingAccountRepository: PagebleAccountRepository,
@ -108,7 +108,7 @@ class Editor(
"revoking" -> model["isRevoking"] = true "revoking" -> model["isRevoking"] = true
else -> model["isNothing"] = true else -> model["isNothing"] = true
} }
if (action == "updating" || action == "deleting") { if (action == "updating" || action == "revoking") {
model["target"] = when (use) { model["target"] = when (use) {
"item" -> { "item" -> {
target?.let { target?.let {

View File

@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping
import team8.fruitable.datebase.repository.AccountRepository import team8.fruitable.datebase.repository.AccountRepository
@Controller @Controller
class Error(private val repository: AccountRepository) : ErrorController { class ErrorPage(private val repository: AccountRepository) : ErrorController {
@RequestMapping("/error") @RequestMapping("/error")
fun error( fun error(
model: Model, model: Model,

View 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"
}
}

View File

@ -1,6 +1,5 @@
package team8.fruitable.controller.page package team8.fruitable.controller.page
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Controller import org.springframework.stereotype.Controller
import org.springframework.ui.Model import org.springframework.ui.Model
import org.springframework.ui.set import org.springframework.ui.set
@ -15,9 +14,6 @@ import team8.fruitable.datebase.repository.ItemRepository
@Controller @Controller
class Pages(private val accountRepository: AccountRepository, private val itemRepository: ItemRepository) { class Pages(private val accountRepository: AccountRepository, private val itemRepository: ItemRepository) {
@Value("\${data.handler}")
lateinit var handler: String
private fun getCurrentUser(token: String?): User? { private fun getCurrentUser(token: String?): User? {
return token?.let(accountRepository::findByToken) 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 } this.getCurrentUser(token)?.let { model["user"] = it }
val item = itemRepository.findById(id).orElse(null) ?: return error(attributes, "查看商品", "不存在的商品") val item = itemRepository.findById(id).orElse(null) ?: return error(attributes, "查看商品", "不存在的商品")
model["item"] = item model["item"] = item
model["itemPicture"] =
item.picture?.let { "${handler}/picture/${it.slice(0..1)}/${it}" } ?: "/images/placeholder.png"
return "item" 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"
}
} }

View File

@ -106,4 +106,9 @@ class Item(
fun getTagString(): String { fun getTagString(): String {
return this.tags.joinToString(" ") return this.tags.joinToString(" ")
} }
@Bean
fun getPictureLink(): String {
return this.picture?.let { "/resourcesNew/picture/${it.slice(0..1)}/${it}" } ?: "/images/placeholder.png"
}
} }

View 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;
}
}

View File

@ -68,51 +68,28 @@ div {
font-weight: bold; font-weight: bold;
} }
> .Options { > .Number {
flex-direction: column;
> .Option {
flex-direction: row; flex-direction: row;
margin: 5px 0; justify-content: space-evenly;
border: 1px solid rgba(0, 120, 255, 0.8);
border-radius: 5px;
> .Title { > .Input {
font-weight: bold; margin-left: 20px;
padding: 0 10px; border-radius: 10px;
border-radius: 5px 0 0 5px; border: 3px solid skyblue;
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;
}
}
} }
} }
> .Buttons { > .Buttons {
justify-content: space-evenly;
text-align: center; text-align: center;
justify-content: space-evenly;
> .Button { > .Button {
width: 90px; flex: 1;
padding: 10px 30px; padding: 8px 30px;
border-radius: 15px; border: 3px solid skyblue;
background-color: darkgreen; border-radius: 10px;
background-color: cadetblue;
font-size: 24px;
} }
} }

View 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;
}
}

View File

@ -12,7 +12,7 @@
<link type="text/css" rel="stylesheet" href="/styles/top.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/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/less.min.js"></script>
<script src="/scripts/lib/anime.min.js"></script> <script src="/scripts/lib/anime.min.js"></script>

View File

@ -2,7 +2,7 @@
<html lang="zh-Hans"> <html lang="zh-Hans">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>编辑 - 在线果蔬商城</title> <title>我的购物车 - 在线果蔬商城</title>
<script type="text/javascript" src="/scripts/header.js"></script> <script type="text/javascript" src="/scripts/header.js"></script>
<script type="text/javascript" src="/scripts/clock.js"></script> <script type="text/javascript" src="/scripts/clock.js"></script>
<script type="text/javascript" src="/scripts/top.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/less" href="/styles/header.less">
<link type="text/css" rel="stylesheet" href="/styles/clock.css"> <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" 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/less.min.js"></script>
<script src="/scripts/lib/anime.min.js"></script> <script src="/scripts/lib/anime.min.js"></script>

View File

@ -8,6 +8,7 @@
<td>更新时间</td> <td>更新时间</td>
<td>价格</td> <td>价格</td>
<td>标签</td> <td>标签</td>
<td>已撤销</td>
<td>操作</td> <td>操作</td>
</tr> </tr>
</thead> </thead>
@ -20,6 +21,7 @@
<td>{{editTime}}</td> <td>{{editTime}}</td>
<td>{{price}}</td> <td>{{price}}</td>
<td>{{tagPretty}}</td> <td>{{tagPretty}}</td>
<td>{{#isRevoked}}是{{/isRevoked}}{{^isRevoked}}否{{/isRevoked}}</td>
<td> <td>
<button class="update">编辑</button> <button class="update">编辑</button>
<button class="revoke">撤销</button> <button class="revoke">撤销</button>
@ -124,9 +126,9 @@
{{/isUpdating}} {{/isUpdating}}
{{#isRevoking}} {{#isRevoking}}
<form class="TabForm" action="/action/edit/item/delete/{{target.id}}" method="post"> <form class="TabForm" action="/action/edit/item/revoke/{{target.id}}" method="post">
<h2>确定要删除商品 {{target.name}} 吗?</h2> <h2>确定要撤销商品 {{target.name}} 吗?</h2>
<button class="TabButton" type="submit">删除</button> <button class="TabButton" type="submit">撤销</button>
</form> </form>
{{/isRevoking}} {{/isRevoking}}
</div> </div>

View File

@ -12,6 +12,7 @@
<td>邮箱</td> <td>邮箱</td>
<td>地址</td> <td>地址</td>
<td>管理员</td> <td>管理员</td>
<td>已禁用</td>
<td>操作</td> <td>操作</td>
</tr> </tr>
</thead> </thead>
@ -28,6 +29,7 @@
<td>{{#email}}{{email}}{{/email}}</td> <td>{{#email}}{{email}}{{/email}}</td>
<td>{{#address}}{{address}}{{/address}}</td> <td>{{#address}}{{address}}{{/address}}</td>
<td>{{#isAdmin}}是{{/isAdmin}}{{^isAdmin}}否{{/isAdmin}}</td> <td>{{#isAdmin}}是{{/isAdmin}}{{^isAdmin}}否{{/isAdmin}}</td>
<td>{{#isRevoked}}是{{/isRevoked}}{{^isRevoked}}否{{/isRevoked}}</td>
<td> <td>
<button class="update">编辑</button> <button class="update">编辑</button>
<button class="revoke">禁用</button> <button class="revoke">禁用</button>
@ -185,9 +187,9 @@
{{/isUpdating}} {{/isUpdating}}
{{#isRevoking}} {{#isRevoking}}
<form class="TabForm" action="/action/edit/user/delete/{{target.id}}" method="post"> <form class="TabForm" action="/action/edit/user/revoke/{{target.id}}" method="post">
<h2>确定要删除用户 {{target.name}} 吗?</h2> <h2>确定要禁用用户 {{target.name}} 吗?</h2>
<button class="TabButton" type="submit">删除</button> <button class="TabButton" type="submit">禁用</button>
</form> </form>
{{/isRevoking}} {{/isRevoking}}
</div> </div>

View File

@ -15,7 +15,11 @@
</div> </div>
<div class="List Blank"></div> <div class="List Blank"></div>
{{#user}} {{#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>
<div class="List Button Link" href="/action/account/logout"><span class="Text">注销</span></div> <div class="List Button Link" href="/action/account/logout"><span class="Text">注销</span></div>
{{#isAdmin}} {{#isAdmin}}

View File

@ -26,9 +26,9 @@
<!-- 页面内容 --> <!-- 页面内容 -->
<div id="Contents"> <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"> <div class="Picture">
<img alt="商品图片" src="{{itemPicture}}"/> <img alt="商品图片" src="{{item.pictureLink}}"/>
</div> </div>
<div class="Infos"> <div class="Infos">
<span class="Title">{{item.name}}</span> <span class="Title">{{item.name}}</span>
@ -48,24 +48,14 @@
<div class="Tag">{{name}}</div> <div class="Tag">{{name}}</div>
{{/item.tags}} {{/item.tags}}
</div> </div>
<div class="Options"> <div class="Number">
<div class="Option"> <label class="Title" for="number">数量</label>
<div class="Title">数量</div> <input class="Input" id="number" type="number" name="number" value="1"
<div class="Contents"> min="1" max="99" required {{#item.isRevoked}}disabled{{/item.isRevoked}}/>
<div class="Option" value="1" selected>&nbsp;1&nbsp;</div>
<div class="Option" value="2">&nbsp;2&nbsp;</div>
<div class="Option" value="3">&nbsp;3&nbsp;</div>
<div class="Option" value="4">&nbsp;4&nbsp;</div>
<div class="Option" value="5">&nbsp;5&nbsp;</div>
<div class="Option" value="6">&nbsp;6&nbsp;</div>
<div class="Option" value="7">&nbsp;7&nbsp;</div>
<div class="Option" value="8">&nbsp;8&nbsp;</div>
</div>
</div>
</div> </div>
<div class="Buttons"> <div class="Buttons">
<span class="Button">加入购物车</span> <button class="Button" type="button" onclick="window.location.replace('/action/cart/add/{{item.id}}')">加入购物车</button>
<span class="Button">立即购买</span> <button class="Button" type="submit" {{#item.isRevoked}}disabled{{/item.isRevoked}}>立即购买</button>
</div> </div>
</div> </div>
</form> </form>

View File

@ -13,7 +13,7 @@
<link type="text/css" rel="stylesheet" href="/styles/top.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/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/less.min.js"></script>
<script src="/scripts/lib/anime.min.js"></script> <script src="/scripts/lib/anime.min.js"></script>

View 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>

View 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>

View 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>

View File

@ -13,7 +13,7 @@
<link type="text/css" rel="stylesheet" href="/styles/top.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/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/less.min.js"></script>
<script src="/scripts/lib/anime.min.js"></script> <script src="/scripts/lib/anime.min.js"></script>