record-fen.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="page-container">
  3. <z-paging ref="paging" v-model="dataList" @query="queryList">
  4. <template #top>
  5. <view class="header">
  6. <view class="search-bar">
  7. <view class="filter-dropdown" @click="showPicker = true">
  8. <text>{{ dateText }}</text>
  9. <u-icon name="arrow-down-fill" size="24rpx" color="#666" top="1"></u-icon>
  10. </view>
  11. <u-search
  12. actionText="搜索"
  13. :animation="true"
  14. bgColor="#f2f2f2"
  15. placeholder="订单号搜索"
  16. v-model="keyword"
  17. ></u-search>
  18. </view>
  19. </view>
  20. </template>
  21. <view class="list-content">
  22. <view v-for="(item, index) in dataList" :key="index" class="record-card flex">
  23. <view class="card-left">
  24. <u-avatar :src="item.avatar" size="68rpx" default-url="/static/common/avatar.png"></u-avatar>
  25. </view>
  26. <view class="card-body">
  27. <view class="left flex">
  28. <view class="order">
  29. <text class="label">订单号:</text>
  30. <text class="value">{{ item.orderNo }}</text>
  31. </view>
  32. </view>
  33. <view class="right flex">
  34. <view class="time">
  35. <text class="label">时间:</text>
  36. <text class="value">{{ item.time }}</text>
  37. </view>
  38. <view class="other">
  39. <text class="symbol">¥</text>
  40. <text class="amount">{{ item.amount }}</text>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </z-paging>
  47. <u-datetime-picker
  48. mode="year-month"
  49. :show="showPicker"
  50. v-model="currentDate"
  51. @confirm="confirmDate"
  52. @cancel="showPicker = false"
  53. ></u-datetime-picker>
  54. </view>
  55. </template>
  56. <script>
  57. export default {
  58. data() {
  59. return {
  60. keyword: '',
  61. dateText: '全部日期',
  62. showPicker: false,
  63. currentDate: Number(new Date()),
  64. dataList: []
  65. };
  66. },
  67. methods: {
  68. confirmDate(e) {
  69. this.dateText = new Date(e.value).Format('YYYY-MM');
  70. this.showPicker = false;
  71. // 此处触发搜索逻辑
  72. },
  73. queryList(pageNo, pageSize) {
  74. console.log(pageNo, pageSize)
  75. // 这里的pageNo和pageSize会自动计算好,直接传给服务器即可
  76. // 这里的请求只是演示,请替换成自己的项目的网络请求,并在网络请求回调中通过this.$refs.paging.complete(请求回来的数组)将请求结果传给z-paging
  77. // this.$request.queryList({ pageNo,pageSize }).then(res => {
  78. // // 请勿在网络请求回调中给dataList赋值!!只需要调用complete就可以了
  79. let res = {
  80. data: {
  81. list: [
  82. { orderNo: '32025050702041853308351', time: '2025-09-14 12:08', amount: '493.4' },
  83. { orderNo: '32025050702041853308351', time: '2025-09-14 12:08', amount: '493.4' },
  84. { orderNo: '32025050702041853308351', time: '2025-09-14 12:08', amount: '493.4' },
  85. { orderNo: '32025050702041853308351', time: '2025-09-14 12:08', amount: '493.4' },
  86. ]
  87. }
  88. }
  89. this.$refs.paging.complete(res.data.list);
  90. // }).catch(res => {
  91. // // 如果请求失败写this.$refs.paging.complete(false),会自动展示错误页面
  92. // // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
  93. // // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
  94. // this.$refs.paging.complete(false);
  95. // })
  96. }
  97. }
  98. };
  99. </script>
  100. <style lang="scss" scoped>
  101. .page-container {
  102. min-height: 100vh;
  103. background: linear-gradient(152deg, #DCFFF8 0%, #F1FEFF 100%);
  104. .header {
  105. padding: 20rpx 24rpx;
  106. background-color: #ffffff;
  107. .search-bar {
  108. display: flex;
  109. align-items: center;
  110. .filter-dropdown {
  111. height: 66rpx;
  112. padding: 0rpx 24rpx;
  113. margin-right: 24rpx;
  114. border-radius: 134rpx;
  115. white-space: nowrap;
  116. background-color: #f2f2f2;
  117. display: flex;
  118. align-items: center;
  119. text {
  120. width: 105rpx;
  121. font-size: 26rpx;
  122. color: #333333;
  123. margin-right: 6rpx;
  124. }
  125. }
  126. }
  127. }
  128. .list-content {
  129. padding: 24rpx;
  130. }
  131. .record-card {
  132. padding: 24rpx;
  133. margin-bottom: 20rpx;
  134. border-radius: 12rpx;
  135. background-color: #ffffff;
  136. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  137. &:last-child {
  138. margin-bottom: 0;
  139. }
  140. .card-left {
  141. margin-right: 20rpx;
  142. }
  143. .card-body {
  144. flex: 1;
  145. .left {
  146. margin-bottom: 8rpx;
  147. }
  148. .right {
  149. align-items: baseline;
  150. justify-content: space-between;
  151. }
  152. }
  153. .order {
  154. font-weight: 500;
  155. font-size: 28rpx;
  156. color: #333333;
  157. .value {
  158. word-break: break-all;
  159. }
  160. }
  161. .time {
  162. font-weight: 400;
  163. font-size: 26rpx;
  164. color: #333333;
  165. }
  166. .other {
  167. display: flex;
  168. align-items: baseline;
  169. .symbol {
  170. font-size: 20rpx;
  171. color: #F53E54;
  172. font-weight: bold;
  173. }
  174. .amount {
  175. font-size: 32rpx;
  176. color: #F53E54;
  177. font-weight: bold;
  178. margin-left: 4rpx;
  179. }
  180. }
  181. }
  182. }
  183. </style>