store_expand_list.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <view class="page-container">
  3. <view class="search-wrapper">
  4. <view class="query">
  5. <u-row customStyle="margin-bottom: 10px" gutter="20">
  6. <u-col span="9">
  7. <u--input
  8. @focus="timeShow = true"
  9. v-model="startTimeXd"
  10. placeholder="开始日期 ~ 结束日期"
  11. prefixIcon="calendar"
  12. prefixIconStyle="font-size: 22px;color: #909399"
  13. @clear="handleSearch"
  14. ></u--input>
  15. </u-col>
  16. <u-col span="3">
  17. <view class="query-btn" @click="clearSearch">
  18. <view class="query-btn-text">清空</view>
  19. </view>
  20. </u-col>
  21. </u-row>
  22. </view>
  23. </view>
  24. <scroll-view class="list-container" scroll-y="true">
  25. <view v-if="recordList.length === 0 && !isLoading" class="empty-list">
  26. <text>暂无数据</text>
  27. </view>
  28. <view class="data-display-container" v-else>
  29. <view class="header-row">
  30. <view class="header-item">日期</view>
  31. <view class="header-item">数量</view>
  32. </view>
  33. <view class="data-body">
  34. <view class="data-row" v-for="(item, index) in recordList" :key="index">
  35. <view class="data-cell item-column">{{ getRowDate(item) }}</view>
  36. <view class="data-cell">{{ getRowCount(item) }}</view>
  37. </view>
  38. </view>
  39. </view>
  40. </scroll-view>
  41. <u-calendar min-date="2025-07-01" max-date="2030-07-01" @close="timeShow = false" :show="timeShow" :mode="mode" @confirm="confirm"></u-calendar>
  42. </view>
  43. </template>
  44. <script>
  45. import {queryStoreExpandCount} from "@/api/hexiao";
  46. export default {
  47. data() {
  48. return {
  49. startTime: '',
  50. endTime: '',
  51. timeShow: false,
  52. startTimeXd:"",
  53. mode: 'range',
  54. isLoading: false,
  55. recordList: [],
  56. ywyId: 0
  57. };
  58. },
  59. onLoad(opt) {
  60. if (opt.ywyId) {
  61. this.ywyId = Number(opt.ywyId);
  62. }
  63. this.fetchRecords();
  64. },
  65. methods: {
  66. confirm(e) {
  67. this.startTime = e[0];
  68. this.endTime = e[e.length-1];
  69. this.startTimeXd = e[0]+' ~ '+e[e.length-1];
  70. this.timeShow = false;
  71. this.handleSearch();
  72. },
  73. clearSearch(){
  74. this.startTime = "";
  75. this.endTime = "";
  76. this.startTimeXd = "";
  77. this.handleSearch();
  78. },
  79. handleSearch() {
  80. this.fetchRecords();
  81. },
  82. fetchRecords() {
  83. if (this.isLoading) {
  84. return;
  85. }
  86. this.isLoading = true;
  87. queryStoreExpandCount({
  88. ywyId: this.ywyId,
  89. startTime: this.startTime,
  90. endTime: this.endTime
  91. }).then(res=>{
  92. this.recordList = res.data || [];
  93. this.isLoading = false;
  94. }).catch(() => {
  95. this.isLoading = false;
  96. });
  97. },
  98. getRowDate(item) {
  99. return item.date || '';
  100. },
  101. getRowCount(item) {
  102. return item.count !== undefined ? item.count : 0;
  103. }
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .page-container {
  109. display: flex;
  110. flex-direction: column;
  111. height: 100vh;
  112. background-color: #f5f6fa;
  113. }
  114. .search-wrapper {
  115. padding: 20rpx;
  116. background-color: #ffffff;
  117. border-bottom: 1rpx solid #f0f0f0;
  118. }
  119. .list-container {
  120. flex: 1;
  121. height: 100%;
  122. }
  123. .empty-list {
  124. text-align: center;
  125. color: #999;
  126. padding-top: 150rpx;
  127. }
  128. .query-btn {
  129. background-color: #409eff;
  130. color: #fff;
  131. padding: 20rpx;
  132. border-radius: 10rpx;
  133. height: 34rpx;
  134. display: flex;
  135. justify-content: center;
  136. align-items: center;
  137. }
  138. .query-btn-text {
  139. font-weight: 400;
  140. font-size: 30rpx;
  141. color: #F5F5F5;
  142. }
  143. .data-display-container {
  144. padding: 30rpx;
  145. font-size: 28rpx;
  146. color: #333;
  147. min-height: 100vh;
  148. box-sizing: border-box;
  149. }
  150. .header-row {
  151. display: flex;
  152. flex-direction: row;
  153. background-color: #4A90E2;
  154. color: #ffffff;
  155. font-weight: bold;
  156. padding: 24rpx 0;
  157. border-bottom: 1rpx solid rgba(255, 255, 255, 0.2);
  158. position: sticky;
  159. top: 0;
  160. z-index: 10;
  161. }
  162. .header-item {
  163. flex: 1;
  164. text-align: center;
  165. padding: 0 10rpx;
  166. font-size: 28rpx;
  167. }
  168. .data-row {
  169. display: flex;
  170. flex-direction: row;
  171. align-items: center;
  172. padding: 20rpx 0;
  173. border-bottom: 1rpx solid #f0f0f0;
  174. }
  175. .data-row:last-child {
  176. border-bottom: none;
  177. }
  178. .data-cell {
  179. flex: 1;
  180. padding: 0 10rpx;
  181. text-align: center;
  182. font-size: 26rpx;
  183. color: #555;
  184. word-break: break-word;
  185. line-height: 1.4;
  186. }
  187. .item-column {
  188. text-align: left;
  189. padding-left: 20rpx;
  190. color: #333;
  191. font-weight: 500;
  192. }
  193. </style>