main.fxml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?import javafx.geometry.*?>
  3. <?import javafx.scene.control.*?>
  4. <?import javafx.scene.layout.*?>
  5. <BorderPane xmlns="http://javafx.com/javafx/23" xmlns:fx="http://javafx.com/fxml/1" fx:controller="space.anyi.client.controller.MainController" prefWidth="1000" prefHeight="700">
  6. <top>
  7. <HBox alignment="CENTER_LEFT" spacing="10" style="-fx-background-color: #2c3e50; -fx-padding: 10 15;">
  8. <Label fx:id="welcomeLabel" text="欢迎" style="-fx-text-fill: white; -fx-font-size: 16px;" HBox.hgrow="ALWAYS"/>
  9. <Button text="退出登录" onAction="#handleLogout" style="-fx-background-color: #e74c3c; -fx-text-fill: white;"/>
  10. </HBox>
  11. </top>
  12. <center>
  13. <TabPane>
  14. <Tab text="浏览书籍" closable="false">
  15. <VBox spacing="10">
  16. <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
  17. <HBox spacing="10">
  18. <TextField fx:id="searchField" promptText="搜索书名/作者..." HBox.hgrow="ALWAYS"/>
  19. <ComboBox fx:id="categoryCombo" prefWidth="150"/>
  20. <Button text="搜索" onAction="#handleSearch"/>
  21. </HBox>
  22. <SplitPane dividerPositions="0.6" VBox.vgrow="ALWAYS">
  23. <TableView fx:id="bookTable">
  24. <columns>
  25. <TableColumn fx:id="bookIdCol" text="编号" prefWidth="50"/>
  26. <TableColumn fx:id="titleCol" text="书名" prefWidth="200"/>
  27. <TableColumn fx:id="authorCol" text="作者" prefWidth="120"/>
  28. <TableColumn fx:id="categoryCol" text="分类" prefWidth="100"/>
  29. <TableColumn fx:id="priceCol" text="价格" prefWidth="80"/>
  30. <TableColumn fx:id="stockCol" text="库存" prefWidth="60"/>
  31. </columns>
  32. </TableView>
  33. <VBox spacing="10" alignment="TOP_CENTER">
  34. <padding><Insets top="10"/></padding>
  35. <Label text="书籍详情"
  36. style="-fx-font-weight: bold; -fx-font-size: 16px;"/>
  37. <Label fx:id="detailTitle" text="-"/>
  38. <Label fx:id="detailAuthor" text="-"/>
  39. <Label fx:id="detailCategory" text="-"/>
  40. <Label fx:id="detailPrice" text="-"/>
  41. <Label fx:id="detailStock" text="-"/>
  42. <TextField fx:id="quantityField" promptText="数量" maxWidth="100"/>
  43. <Button text="购买" onAction="#handlePurchase" style="-fx-background-color: #27ae60; -fx-text-fill: white;"/>
  44. </VBox>
  45. </SplitPane>
  46. </VBox>
  47. </Tab>
  48. <Tab text="我的交易" closable="false">
  49. <VBox spacing="10">
  50. <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
  51. <Button text="刷新" onAction="#handleLoadTransactions"/>
  52. <TableView fx:id="transTable" VBox.vgrow="ALWAYS">
  53. <columns>
  54. <TableColumn fx:id="transIdCol" text="交易编号" prefWidth="80"/>
  55. <TableColumn fx:id="transBookIdCol" text="书籍编号" prefWidth="80"/>
  56. <TableColumn fx:id="transNumCol" text="数量" prefWidth="80"/>
  57. <TableColumn fx:id="transPriceCol" text="总价" prefWidth="100"/>
  58. <TableColumn fx:id="transTimeCol" text="时间" prefWidth="200"/>
  59. </columns>
  60. </TableView>
  61. </VBox>
  62. </Tab>
  63. <Tab text="个人信息" closable="false">
  64. <VBox spacing="12" maxWidth="400">
  65. <padding><Insets top="20" right="20" bottom="20" left="20"/></padding>
  66. <Label text="个人信息"
  67. style="-fx-font-weight: bold; -fx-font-size: 16px;"/>
  68. <HBox spacing="10"><Label text="用户名:" prefWidth="100"/><TextField fx:id="profileUsername" editable="false"/></HBox>
  69. <HBox spacing="10"><Label text="昵称:" prefWidth="100"/><TextField fx:id="profileNickname"/></HBox>
  70. <HBox spacing="10"><Label text="邮箱:" prefWidth="100"/><TextField fx:id="profileEmail"/></HBox>
  71. <HBox spacing="10"><Label text="电话:" prefWidth="100"/><TextField fx:id="profilePhone"/></HBox>
  72. <HBox spacing="10"><Label text="院系:" prefWidth="100"/><TextField fx:id="profileDept"/></HBox>
  73. <HBox spacing="10"><Label text="信用分:" prefWidth="100"/><Label fx:id="profileCredit"/></HBox>
  74. <Button text="保存修改" onAction="#handleUpdateProfile"/>
  75. </VBox>
  76. </Tab>
  77. <Tab fx:id="sellerTab" text="卖家中心" closable="false">
  78. <VBox spacing="10">
  79. <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
  80. <Label text="我的书籍" style="-fx-font-weight: bold;"/>
  81. <Button text="刷新" onAction="#handleLoadMyBooks"/>
  82. <TableView fx:id="myBookTable" VBox.vgrow="ALWAYS">
  83. <columns>
  84. <TableColumn fx:id="myBookIdCol" text="编号" prefWidth="50"/>
  85. <TableColumn fx:id="myBookTitleCol" text="书名" prefWidth="250"/>
  86. <TableColumn fx:id="myBookPriceCol" text="价格" prefWidth="80"/>
  87. <TableColumn fx:id="myBookStockCol" text="库存" prefWidth="60"/>
  88. </columns>
  89. </TableView>
  90. <Button text="删除选中" onAction="#handleDeleteBook"/>
  91. <TitledPane text="添加新书" expanded="false">
  92. <GridPane hgap="10" vgap="8">
  93. <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
  94. <Label text="书名" GridPane.rowIndex="0" GridPane.columnIndex="0"/><TextField fx:id="newTitle" GridPane.rowIndex="0" GridPane.columnIndex="1"/>
  95. <Label text="作者" GridPane.rowIndex="1" GridPane.columnIndex="0"/><TextField fx:id="newAuthor" GridPane.rowIndex="1" GridPane.columnIndex="1"/>
  96. <Label text="分类" GridPane.rowIndex="2" GridPane.columnIndex="0"/><TextField fx:id="newCategory" GridPane.rowIndex="2" GridPane.columnIndex="1"/>
  97. <Label text="原价" GridPane.rowIndex="3" GridPane.columnIndex="0"/><TextField fx:id="newOriginalPrice" GridPane.rowIndex="3" GridPane.columnIndex="1"/>
  98. <Label text="售价" GridPane.rowIndex="4" GridPane.columnIndex="0"/><TextField fx:id="newSellingPrice" GridPane.rowIndex="4" GridPane.columnIndex="1"/>
  99. <Label text="库存" GridPane.rowIndex="5" GridPane.columnIndex="0"/><TextField fx:id="newStock" GridPane.rowIndex="5" GridPane.columnIndex="1"/>
  100. <Button text="添加书籍" onAction="#handleAddBook" GridPane.rowIndex="6" GridPane.columnIndex="1"/>
  101. </GridPane>
  102. </TitledPane>
  103. </VBox>
  104. </Tab>
  105. <Tab text="数据统计" closable="false">
  106. <ScrollPane fitToWidth="true">
  107. <VBox spacing="15">
  108. <padding><Insets top="15" right="15" bottom="15" left="15"/></padding>
  109. <Button text="刷新数据" onAction="#handleLoadStatistics" maxWidth="200"/>
  110. <TitledPane text="总览" expanded="true">
  111. <HBox spacing="40">
  112. <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
  113. <VBox spacing="5">
  114. <Label text="交易总金额" style="-fx-font-weight: bold;"/>
  115. <Label fx:id="statTotalAmount" text="-" style="-fx-font-size: 20px; -fx-text-fill: #27ae60;"/>
  116. </VBox>
  117. <VBox spacing="5">
  118. <Label text="交易总笔数" style="-fx-font-weight: bold;"/>
  119. <Label fx:id="statTotalCount" text="-" style="-fx-font-size: 20px;"/>
  120. </VBox>
  121. </HBox>
  122. </TitledPane>
  123. <TitledPane text="热门院系(销量前三)" expanded="true">
  124. <TableView fx:id="deptTable" prefHeight="150">
  125. <columns>
  126. <TableColumn fx:id="deptNameCol" text="院系" prefWidth="250"/>
  127. <TableColumn fx:id="deptSalesCol" text="销售额" prefWidth="200"/>
  128. </columns>
  129. </TableView>
  130. </TitledPane>
  131. <TitledPane text="热门书籍(前五)" expanded="true">
  132. <TableView fx:id="hotBookTable" prefHeight="150">
  133. <columns>
  134. <TableColumn fx:id="hotBookIdCol" text="编号" prefWidth="50"/>
  135. <TableColumn fx:id="hotBookTitleCol" text="书名" prefWidth="250"/>
  136. <TableColumn fx:id="hotBookAuthorCol" text="作者" prefWidth="120"/>
  137. <TableColumn fx:id="hotBookSoldCol" text="销量" prefWidth="80"/>
  138. </columns>
  139. </TableView>
  140. </TitledPane>
  141. <TitledPane text="各院系平均折扣率" expanded="true">
  142. <TableView fx:id="discountTable" prefHeight="150">
  143. <columns>
  144. <TableColumn fx:id="discountDeptCol" text="院系" prefWidth="250"/>
  145. <TableColumn fx:id="discountRateCol" text="平均折扣率" prefWidth="200"/>
  146. </columns>
  147. </TableView>
  148. </TitledPane>
  149. </VBox>
  150. </ScrollPane>
  151. </Tab>
  152. <Tab fx:id="adminTab" text="管理" closable="false">
  153. <VBox spacing="10">
  154. <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
  155. <Label text="用户管理"
  156. style="-fx-font-weight: bold; -fx-font-size: 16px;"/>
  157. <Button text="刷新用户" onAction="#handleLoadAllUsers"/>
  158. <TableView fx:id="userTable" VBox.vgrow="ALWAYS">
  159. <columns>
  160. <TableColumn fx:id="userIdCol" text="编号" prefWidth="50"/>
  161. <TableColumn fx:id="userNameCol" text="用户名" prefWidth="120"/>
  162. <TableColumn fx:id="userNicknameCol" text="昵称" prefWidth="120"/>
  163. <TableColumn fx:id="userDeptCol" text="院系" prefWidth="150"/>
  164. <TableColumn fx:id="userCreditCol" text="信用分" prefWidth="60"/>
  165. <TableColumn fx:id="userRoleCol" text="角色" prefWidth="60"/>
  166. <TableColumn fx:id="userSellerCol" text="卖家" prefWidth="60"/>
  167. </columns>
  168. </TableView>
  169. <Button text="删除选中用户" onAction="#handleDeleteUser" style="-fx-background-color: #e74c3c; -fx-text-fill: white;"/>
  170. <Label text="全部交易" style="-fx-font-weight: bold; -fx-font-size: 16px;"/>
  171. <Button text="刷新交易" onAction="#handleLoadAllTransactions"/>
  172. <TableView fx:id="allTransTable" VBox.vgrow="ALWAYS">
  173. <columns>
  174. <TableColumn fx:id="allTransIdCol" text="交易编号" prefWidth="60"/>
  175. <TableColumn fx:id="allTransBookIdCol" text="书籍编号" prefWidth="60"/>
  176. <TableColumn fx:id="allTransBuyerIdCol" text="买家编号" prefWidth="60"/>
  177. <TableColumn fx:id="allTransNumCol" text="数量" prefWidth="40"/>
  178. <TableColumn fx:id="allTransPriceCol" text="价格" prefWidth="100"/>
  179. <TableColumn fx:id="allTransTimeCol" text="时间" prefWidth="200"/>
  180. </columns>
  181. </TableView>
  182. <Button text="删除选中交易" onAction="#handleDeleteTransaction" style="-fx-background-color: #e74c3c; -fx-text-fill: white;"/>
  183. </VBox>
  184. </Tab>
  185. </TabPane>
  186. </center>
  187. </BorderPane>