reshuiDetails.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <view class="container">
  3. <view class="line"></view>
  4. <view class="same-month">
  5. <view class="title">
  6. <view class="vertical-line"></view>
  7. <view class="title-txt"><text class="caption">充值详情</text></view>
  8. </view>
  9. <view class="content-details">
  10. <uni-table :border="true" :stripe="true" emptyText="暂无更多数据">
  11. <!-- 表头行 -->
  12. <uni-tr>
  13. <uni-th width="30" align="center">姓名</uni-th>
  14. <uni-th width="30" align="center">金额</uni-th>
  15. <uni-th width="30" align="center">时间</uni-th>
  16. </uni-tr>
  17. <!-- 表格数据行 -->
  18. <uni-tr v-for="(item, index) in tableData" :key="index">
  19. <uni-td align="center">{{item.user_name}}</uni-td>
  20. <uni-td align="center">{{item.account}}</uni-td>
  21. <uni-td align="center">{{item.re_time}}</uni-td>
  22. </uni-tr>
  23. </uni-table>
  24. </view>
  25. <view class="uni-pagination-box">
  26. <uni-pagination :page-size="pageSize" :current="pageCurrent" :total="totalNum" @change="page_change" />
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. tableData: [],
  36. ceshi: 'code',
  37. stu_number: '', // 学号
  38. // 每页数据量
  39. pageSize: 12,
  40. // 当前页
  41. pageCurrent: 1,
  42. // 数据总量
  43. totalNum: 0
  44. }
  45. },
  46. onLoad() {
  47. try {
  48. // 获取学号
  49. this.stu_number = this.$store.state.userInfo.card_number
  50. this.roomSelect = this.$store.state.building.roomSelect
  51. if (this.stu_number == '' || this.roomSelect == '' || typeof(this.stu_number) == 'undefined' || typeof(this
  52. .roomSelect) == 'undefined') {
  53. const userinfo = uni.getStorageSync('userinfo_storage_key')
  54. if (userinfo) {
  55. this.stu_number = userinfo.card_number
  56. this.roomSelect = userinfo.campus + userinfo.dorm_number
  57. } else {
  58. uni.redirectTo({
  59. url: '../../pages/index/index'
  60. })
  61. uni.showToast({
  62. icon: 'none',
  63. title: '学号或宿舍号为空,请授权',
  64. duration: 1500
  65. })
  66. return
  67. }
  68. }
  69. // console.log(this.stu_number);
  70. this.get_history()
  71. } catch (e) {
  72. uni.showToast({
  73. title: '获取学号异常:' + e.message,
  74. duration: 1500
  75. })
  76. console.log('获取学号异常:' + e.message);
  77. }
  78. },
  79. methods: {
  80. /**
  81. * 分页,页码改变
  82. */
  83. page_change(e) {
  84. this.pageCurrent = e.current
  85. this.get_history()
  86. },
  87. /**
  88. * 充值详情
  89. */
  90. async get_history() {
  91. let _this = this
  92. let res = await this.$myRequest({
  93. host: this.ceshi,
  94. url: '/HotWaters/wpqueryRecharge.action',
  95. method: 'POST',
  96. header: {
  97. 'content-type': 'application/x-www-form-urlencoded'
  98. },
  99. data: {
  100. 'stu_number': this.stu_number,
  101. // 'stu_number': '360481200301045025',
  102. 'page': _this.pageCurrent,
  103. 'rows': _this.pageSize
  104. }
  105. })
  106. // console.log(res.data)
  107. if (res.data.rows.length == 0) {
  108. return
  109. }
  110. if (typeof res.data.rows === 'undefined') {
  111. uni.showToast({
  112. title: '加载数据异常',
  113. duration: 1500
  114. })
  115. return
  116. } else {
  117. let tdata = []
  118. for (let i = 0; i < res.data.rows.length; i++) {
  119. let user_name = res.data.rows[i].user_name
  120. let account = res.data.rows[i].account
  121. let re_time = res.data.rows[i].re_time
  122. account = '¥' + account.toFixed(2)
  123. tdata.push({
  124. user_name,
  125. account,
  126. re_time
  127. })
  128. }
  129. // 填充表格
  130. this.tableData = tdata
  131. // 填充分页参数
  132. this.totalNum = res.data.total
  133. this.pageSize = res.data.numPerPage
  134. this.pageCurrent = res.data.currentPage
  135. this.totalPage = res.data.totalPage
  136. }
  137. }
  138. }
  139. }
  140. </script>
  141. <style scoped lang="scss">
  142. .container {
  143. display: flex;
  144. flex-direction: column;
  145. font-size: 29upx;
  146. font-family: "Microsoft YaHei";
  147. .line {
  148. height: 10rpx;
  149. background-color: #f5f5f5;
  150. }
  151. .same-month {
  152. display: flex;
  153. flex-direction: column;
  154. padding: 20rpx 30rpx;
  155. .title {
  156. display: flex;
  157. align-items: center;
  158. margin-bottom: 30rpx;
  159. .vertical-line {
  160. display: inline-block;
  161. margin-right: 20rpx;
  162. width: 10rpx;
  163. height: 45rpx;
  164. background-color: #0282F8;
  165. }
  166. .title-txt {
  167. display: flex;
  168. flex-direction: row;
  169. align-items: flex-end;
  170. color: #C1C1C1;
  171. .caption {
  172. color: #2b2b2b;
  173. font-size: 40upx;
  174. }
  175. .hah {
  176. display: flex;
  177. margin: 0 10rpx;
  178. }
  179. }
  180. }
  181. .content-details {
  182. display: flex;
  183. justify-content: space-around;
  184. .item {
  185. display: flex;
  186. flex-direction: column;
  187. align-items: center;
  188. .num {
  189. font-size: 40upx;
  190. }
  191. .description {
  192. color: #9a9a9a;
  193. }
  194. }
  195. /deep/ .uni-table {
  196. .uni-table-th {
  197. padding: 6px 8px;
  198. font-size: 26upx;
  199. white-space: nowrap;
  200. text-align: center;
  201. background-color: #E5F2FE;
  202. color: #5b5b5d;
  203. }
  204. .uni-table-td {
  205. padding: 3px 5px;
  206. font-size: 26upx;
  207. white-space: nowrap;
  208. text-align: center;
  209. color: #000000;
  210. }
  211. }
  212. }
  213. }
  214. }
  215. </style>