sale_detail.vue 9.9 KB

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