hexiao_detail_ywy.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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. @input="handleSearch"
  14. @change="change"
  15. ></u--input>
  16. </u-col>
  17. <u-col span="3">
  18. <view class="query-btn" @click="show = !show">
  19. <view class="query-btn-icon">
  20. </view>
  21. <view class="query-btn-text">筛选</view>
  22. </view>
  23. </u-col>
  24. </u-row>
  25. </view>
  26. </view>
  27. <scroll-view class="list-container" scroll-y="true" @scrolltolower="loadMore">
  28. <view v-if="recordList.length === 0 && loadStatus !== 'loading'" class="empty-list">
  29. <text>暂无数据</text>
  30. </view>
  31. <view class="data-display-container" v-if="recordList.length>0">
  32. <view class="header-row">
  33. <view class="header-item">项目</view>
  34. <view class="header-item">核销数据</view>
  35. <!-- <view class="header-item">销售数据</view>-->
  36. </view>
  37. <view class="data-body">
  38. <view class="data-row" v-for="(item, index) in recordList" :key="index">
  39. <view class="data-cell item-column">{{ item.prizeName }}</view>
  40. <view class="data-cell">{{ item.sumTotal }}</view>
  41. <!-- <view class="data-cell">{{ item.orderAmount }}</view>-->
  42. </view>
  43. <view class="data-row">
  44. <view class="data-cell item-column">汇总</view>
  45. <view class="data-cell">{{ totalInfo.totalCount }}</view>
  46. <!-- <view class="data-cell">{{ totalInfo.activateTotal }}</view>-->
  47. </view>
  48. </view>
  49. </view>
  50. </scroll-view>
  51. <u-popup :show="show" mode="bottom" @close="show = false" >
  52. <view class="popup-content">
  53. <view class="popup-text">筛选</view>
  54. <u-row customStyle="margin-bottom: 10px">
  55. <u-col span="3">
  56. <view class="explain">选择日期</view>
  57. </u-col>
  58. <u-col span="9">
  59. <u--input
  60. v-model="startTimeXd"
  61. placeholder="开始日期 ~ 结束日期"
  62. prefixIcon="calendar"
  63. prefixIconStyle="font-size: 22px;color: #909399"
  64. @focus="timeShow = true"
  65. ></u--input>
  66. </u-col>
  67. </u-row>
  68. <view class="popup-btn">
  69. <u-button @click="handleSearch" class="popup-btn-one">搜索</u-button>
  70. <u-button @click="resetForm" class="popup-btn-one" type="primary">重置</u-button>
  71. </view>
  72. </view>
  73. </u-popup>
  74. <u-calendar min-date="2025-07-01" max-date="2030-07-01" @close="timeShow = false" :show="timeShow" :mode="mode" @confirm="confirm"></u-calendar>
  75. </view>
  76. </template>
  77. <script>
  78. import {queryYwyWritePrizeDetail} from "@/api/hexiao";
  79. export default {
  80. data() {
  81. return {
  82. startTime: '',
  83. endTime: '',
  84. timeShow: false,
  85. startTimeXd:"",
  86. mode: 'range',
  87. show:false,
  88. searchQuery: '',
  89. recordList: [],
  90. totalInfo:{saleTotal:0,activateTotal:0},
  91. ywyId:0,
  92. pagination: {
  93. page: 1,
  94. limit: 10,
  95. },
  96. loadStatus: 'more', // 'more'-加载前, 'loading'-加载中, 'noMore'-没有更多了
  97. isLoading: false,
  98. };
  99. },
  100. onLoad(opt) {
  101. // 页面加载时获取第一页数据
  102. if(opt.id){
  103. this.ywyId = opt.id
  104. }
  105. this.fetchRecords(true);
  106. },
  107. // 监听下拉刷新
  108. onPullDownRefresh() {
  109. // this.fetchRecords(true);
  110. },
  111. methods: {
  112. detail(id){
  113. uni.navigateTo({ url: `/pages/hexiao/ywy/patrol_detail?id=`+id });
  114. },
  115. // 核心:获取记录列表数据
  116. async fetchRecords(isRefresh = false) {
  117. if (this.isLoading || (this.loadStatus === 'noMore' && !isRefresh)) {
  118. return;
  119. }
  120. this.isLoading = true;
  121. this.loadStatus = 'loading';
  122. // 在这里替换成您真实的 uni.request API 调用
  123. queryYwyWritePrizeDetail({salesmanId:this.ywyId,startTime:this.startTime,endTime:this.endTime}).then(res=>{
  124. this.recordList = res.data.list;
  125. this.isLoading = false;
  126. this.totalInfo = {totalCount:res.data.totalCount}
  127. });
  128. },
  129. resetForm(){
  130. this.searchQuery = "";
  131. this.startTime = "";
  132. this.endTime = "";
  133. this.startTimeXd = "";
  134. },
  135. confirm(e) {
  136. this.startTime = e[0];
  137. this.endTime = e[e.length-1];
  138. this.startTimeXd = e[0]+' ~ '+e[e.length-1];
  139. if(!this.show){
  140. this.handleSearch()
  141. }
  142. this.timeShow = false;
  143. },
  144. // 上拉加载更多
  145. loadMore() {
  146. this.fetchRecords();
  147. },
  148. // 搜索
  149. handleSearch() {
  150. // 在实际项目中,搜索应该调用API,这里为简单起见只做前端筛选
  151. this.fetchRecords(true);
  152. }
  153. }
  154. }
  155. </script>
  156. <style lang="scss" scoped>
  157. .page-container {
  158. display: flex;
  159. flex-direction: column;
  160. height: 100vh;
  161. background-color: #f5f6fa;
  162. }
  163. .search-wrapper {
  164. padding: 20rpx;
  165. background-color: #ffffff;
  166. border-bottom: 1rpx solid #f0f0f0;
  167. }
  168. .search-bar {
  169. display: flex;
  170. align-items: center;
  171. background-color: #f5f6fa;
  172. border-radius: 50rpx;
  173. padding: 0 25rpx;
  174. height: 70rpx;
  175. }
  176. .search-input {
  177. flex: 1;
  178. font-size: 28rpx;
  179. margin-left: 15rpx;
  180. }
  181. .placeholder {
  182. color: #b0b0b0;
  183. }
  184. .list-container {
  185. flex: 1;
  186. height: 100%; // 必须给scroll-view一个明确的高度
  187. }
  188. .empty-list {
  189. text-align: center;
  190. color: #999;
  191. padding-top: 150rpx;
  192. }
  193. .record-card {
  194. background-color: #ffffff;
  195. border-radius: 16rpx;
  196. margin: 20rpx;
  197. position: relative;
  198. overflow: hidden;
  199. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
  200. }
  201. .card-decorator {
  202. position: absolute;
  203. left: 0;
  204. top: 0;
  205. bottom: 0;
  206. width: 8rpx;
  207. background-color: #e3efff;
  208. }
  209. .card-content {
  210. padding: 30rpx;
  211. padding-left: 40rpx;
  212. }
  213. .card-header {
  214. display: flex;
  215. align-items: center;
  216. padding-bottom: 20rpx;
  217. border-bottom: 1rpx solid #f5f5f5;
  218. .record-id {
  219. font-size: 30rpx;
  220. font-weight: bold;
  221. color: #333;
  222. margin-left: 15rpx;
  223. }
  224. }
  225. .details-section {
  226. padding-top: 10rpx;
  227. }
  228. .detail-row {
  229. display: flex;
  230. justify-content: space-between;
  231. align-items: center;
  232. padding: 15rpx 0;
  233. font-size: 28rpx;
  234. .detail-label {
  235. color: #666;
  236. }
  237. .detail-value {
  238. color: #333;
  239. }
  240. &.product-item .detail-label {
  241. color: #333; // 商品名称颜色深一些
  242. font-weight: 400;
  243. }
  244. .reward {
  245. color: #ff9900;
  246. font-weight: 500;
  247. }
  248. }
  249. .query-btn {
  250. background-color: #409eff;
  251. color: #fff;
  252. padding: 20rpx;
  253. border-radius: 10rpx;
  254. height: 34rpx;
  255. display: flex;
  256. justify-content: center;
  257. align-items: center;
  258. }
  259. .query-btn-icon {
  260. height: 32rpx;
  261. width: 32rpx;
  262. background-image:
  263. url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/queryIoc.png");
  264. background-size: cover;
  265. background-position: center;
  266. background-repeat: no-repeat;
  267. }
  268. .query-btn-text {
  269. font-weight: 400;
  270. font-size: 30rpx;
  271. color: #F5F5F5;
  272. }
  273. .popup-content{
  274. height: 25vh;
  275. padding: 10px;
  276. }
  277. .popup-text{
  278. font-family: PingFang SC;
  279. font-weight: bold;
  280. font-size: 36rpx;
  281. color: #1C1E1D;
  282. text-align: center;
  283. margin-bottom: 10px;
  284. }
  285. .popup-btn{
  286. display: flex;
  287. justify-content: space-around;
  288. }
  289. .popup-btn-one{
  290. width: 275rpx;
  291. height: 70rpx;
  292. background: linear-gradient(0deg, #6FA4FE, #488CFF);
  293. box-shadow: 0rpx 9rpx 16rpx 0rpx rgba(153,153,153,0.35);
  294. border-radius: 35rpx;
  295. }
  296. .data-display-container {
  297. padding: 30rpx;
  298. font-size: 28rpx;
  299. color: #333;
  300. min-height: 100vh; /* 确保内容撑满整个视口高度 */
  301. box-sizing: border-box; /* 边框和内边距包含在元素的总宽度和高度内 */
  302. }
  303. .card {
  304. background-color: #ffffff;
  305. border-radius: 16rpx;
  306. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08); /* 更柔和的阴影 */
  307. overflow: hidden; /* 确保圆角显示 */
  308. display: flex;
  309. flex-direction: column;
  310. max-height: calc(100vh - 60rpx); /* 卡片最大高度,留出上下padding */
  311. }
  312. .header-row {
  313. display: flex;
  314. flex-direction: row;
  315. background-color: #4A90E2; /* 品牌蓝色 */
  316. color: #ffffff;
  317. font-weight: bold;
  318. padding: 24rpx 0; /* 上下内边距增加 */
  319. border-bottom: 1rpx solid rgba(255, 255, 255, 0.2); /* 浅色边框 */
  320. position: sticky; /* 头部固定 */
  321. top: 0;
  322. z-index: 10;
  323. }
  324. .header-item {
  325. flex: 1;
  326. text-align: center;
  327. padding: 0 10rpx; /* 左右内边距 */
  328. font-size: 28rpx;
  329. }
  330. .data-body-scroll {
  331. flex: 1; /* 占据剩余空间 */
  332. overflow-y: auto; /* 允许滚动 */
  333. -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
  334. }
  335. .data-row {
  336. display: flex;
  337. flex-direction: row;
  338. align-items: center; /* 垂直居中对齐 */
  339. padding: 20rpx 0; /* 上下内边距 */
  340. border-bottom: 1rpx solid #f0f0f0; /* 更细的分割线 */
  341. transition: background-color 0.2s ease; /* 鼠标悬停或点击的平滑过渡 */
  342. }
  343. .data-row:last-child {
  344. border-bottom: none; /* 最后一行没有底部边框 */
  345. }
  346. .data-row.even-row {
  347. background-color: #f9f9f9; /* 隔行变色 */
  348. }
  349. .data-row:hover {
  350. background-color: #eef7ff; /* 悬停效果 */
  351. }
  352. .data-cell {
  353. flex: 1;
  354. padding: 0 10rpx; /* 左右内边距 */
  355. text-align: center;
  356. font-size: 26rpx; /* 数据字体略小 */
  357. color: #555;
  358. word-break: break-word; /* 允许长文本在任何地方换行 */
  359. line-height: 1.4; /* 增加行高 */
  360. }
  361. .item-column {
  362. text-align: left;
  363. padding-left: 20rpx; /* 品项左边距 */
  364. color: #333;
  365. font-weight: 500;
  366. }
  367. .no-data {
  368. text-align: center;
  369. padding: 40rpx;
  370. color: #999;
  371. font-size: 30rpx;
  372. }
  373. </style>