hexiao_record.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. <template>
  2. <view class="page-container">
  3. <view class="sticky-header">
  4. <!-- <view class="search-wrapper">-->
  5. <!-- <view class="query">-->
  6. <!-- <u-row customStyle="margin-bottom: 10px" gutter="20">-->
  7. <!-- <u-col span="9">-->
  8. <!-- <u&#45;&#45;input-->
  9. <!-- @focus="timeShow = true"-->
  10. <!-- v-model="startTimeXd"-->
  11. <!-- placeholder="开始日期 ~ 结束日期"-->
  12. <!-- prefixIcon="calendar"-->
  13. <!-- prefixIconStyle="font-size: 22px;color: #909399"-->
  14. <!-- @clear="handleSearch"-->
  15. <!-- ></u&#45;&#45;input>-->
  16. <!-- </u-col>-->
  17. <!-- <u-col span="3">-->
  18. <!-- <view class="query-btn" @click="clearSearch">-->
  19. <!-- <view class="query-btn-text">清空</view>-->
  20. <!-- </view>-->
  21. <!-- </u-col>-->
  22. <!-- </u-row>-->
  23. <!-- </view>-->
  24. <!-- </view>-->
  25. <view class="tabs-wrapper">
  26. <view
  27. v-for="tab in tabs"
  28. :key="tab.key"
  29. class="tab-item"
  30. :class="{ 'active': currentTab === tab.id }"
  31. @click="changeTab(tab.id)"
  32. >
  33. {{ tab.name }}
  34. </view>
  35. </view>
  36. </view>
  37. <view v-if="currentTab == 1">
  38. <scroll-view class="list-container" scroll-y="true" @scrolltolower="loadMore" >
  39. <view v-if="pendingList.length === 0 && loadStatus !== 'loading'" class="empty-list">
  40. <text>暂无相关记录</text>
  41. </view>
  42. <view v-for="(pendInfo) in pendingList" :key="pendInfo.ywyId" class="record-card">
  43. <view class="card-header" @click="detail(pendInfo.ywyId,1)">
  44. <uni-icons type="paperclip" size="20" color="#3c82f8"></uni-icons>
  45. <text class="record-id" style="text-decoration: underline">{{ pendInfo.ywyName }}</text>
  46. <view class="status-badge pending">
  47. {{ getStatusText(0) }}
  48. </view>
  49. </view>
  50. <view class="card-body">
  51. <view class="detail-row product-item" v-for="(item, index) in pendInfo.detail" :key="index">
  52. <text class="detail-label">{{ item.categoryName }}</text>
  53. <text class="detail-value">{{ item.num }}</text>
  54. </view>
  55. </view>
  56. <view class="card-footer">
  57. <button class="verify-btn" @click="verify(pendInfo.ywyId)">核销</button>
  58. </view>
  59. </view>
  60. <uni-load-more :status="loadStatus"></uni-load-more>
  61. </scroll-view>
  62. <view class="fixed-footer" v-if="pendingList.length>0">
  63. <button class="add-btn" @click="verify(-1)">一键核销</button>
  64. </view>
  65. </view>
  66. <scroll-view class="list-container" scroll-y="true" @scrolltolower="loadMore" v-if="currentTab>1 && currentTab<4">
  67. <view v-if="recordList.length === 0 && loadStatus !== 'loading'" class="empty-list">
  68. <text>暂无相关记录</text>
  69. </view>
  70. <view v-for="record in recordList" :key="record.orderNo" class="record-card">
  71. <view class="card-header">
  72. <uni-icons type="paperclip" size="20" color="#3c82f8"></uni-icons>
  73. <text class="record-id" @click="detail(record.id)" style="text-decoration: underline">{{ record.orderNo }}</text>
  74. <view class="status-badge verifying" v-if="record.status === 0">
  75. {{ getStatusText(record.status) }}
  76. </view>
  77. <view class="status-badge verified" style="background-color: #54CFAB" v-if="record.status === 1">
  78. {{ getStatusText(record.status) }}
  79. </view>
  80. </view>
  81. <view class="card-body">
  82. <!-- <view class="detail-row">-->
  83. <!-- <text class="detail-label">业务员名称</text>-->
  84. <!-- <text class="detail-value">{{ record.ywyName }}</text>-->
  85. <!-- </view>-->
  86. <view class="detail-row" >
  87. <text class="detail-label">提交时间</text>
  88. <text class="detail-value">{{ record. dealerApplyTime }}</text>
  89. </view>
  90. <!-- <view class="detail-row" v-if="record.status === 1">-->
  91. <!-- <text class="detail-label">审核时间</text>-->
  92. <!-- <text class="detail-value">{{ record.finishTime }}</text>-->
  93. <!-- </view>-->
  94. <view class="detail-row">
  95. <text class="detail-label">商品总数</text>
  96. <text class="detail-value">{{ record.writeOffNum }}</text>
  97. </view>
  98. <view class="detail-row product-item" v-for="(item, index) in record.writeOffRecordDetailVos" :key="index">
  99. <text class="detail-label">{{ item.categoryName }}</text>
  100. <text class="detail-value">{{ item.num }}</text>
  101. </view>
  102. </view>
  103. </view>
  104. <uni-load-more :status="loadStatus"></uni-load-more>
  105. </scroll-view>
  106. <view v-if="currentTab == 4" style="
  107. padding-top: 17px;
  108. padding-right: 17px;">
  109. <view class="query-btn" style="width: 25%;float: right" @click="toHistory()">
  110. <view class="query-btn-icon">
  111. </view>
  112. <view class="query-btn-text">详情记录</view>
  113. </view>
  114. </view>
  115. <scroll-view v-if="currentTab == 4">
  116. <view class="data-display-container">
  117. <view class="header-row">
  118. <view class="header-item">项目</view>
  119. <view class="header-item">已核销</view>
  120. <view class="header-item">未核销</view>
  121. </view>
  122. <view class="data-body">
  123. <view class="data-row" v-for="(item, index) in hexiaoList" :key="index">
  124. <view class="data-cell item-column">{{ item.itemName }}</view>
  125. <view class="data-cell">{{ item.writeOffCount }}</view>
  126. <view class="data-cell">{{ item.waitWriteOffCount }}</view>
  127. </view>
  128. </view>
  129. </view>
  130. </scroll-view>
  131. <u-calendar min-date="2025-07-01" max-date="2030-07-01" @close="timeShow = false" :show="timeShow" :mode="mode" @confirm="confirm"></u-calendar>
  132. </view>
  133. </template>
  134. <script>
  135. import {queryJxsAddRecord,doCommitToJxs,doCommitToChang, queryHexiaoRecord,queryPendingWriteOffRecord,queryWriteOffDetailByItem} from "@/api/hexiao";
  136. export default {
  137. data() {
  138. return {
  139. startTime: '',
  140. endTime: '',
  141. timeShow: false,
  142. startTimeXd:"",
  143. mode: 'range',
  144. searchQuery: '',
  145. tabs: [
  146. { name: '待审核', key: 'pending',id: 1 },
  147. // { name: '核销中', key: 'verifying', id: 2},
  148. { name: '已提交', key: 'verified' , id :3},
  149. { name: '我的账户', key: 'zhanghu' , id :4},
  150. ],
  151. currentTab: 1,
  152. recordList: [],
  153. hexiaoList:[],
  154. pendingList:[],
  155. pagination: { page: 1, limit: 10 },
  156. loadStatus: 'more', // 'more', 'loading', 'noMore'
  157. isLoading: false,
  158. };
  159. },
  160. onLoad() {
  161. this.getReadyData(true);
  162. },
  163. onPullDownRefresh() {
  164. this.fetchRecords(true);
  165. },
  166. methods: {
  167. toHistory(){
  168. uni.navigateTo({ url: `/pages/hexiao/jxs/hexiao_record_history`});
  169. },
  170. confirm(e) {
  171. this.startTime = e[0];
  172. this.endTime = e[e.length-1];
  173. this.startTimeXd = e[0]+' ~ '+e[e.length-1];
  174. if(!this.show){
  175. this.handleSearch()
  176. }
  177. this.timeShow = false;
  178. },
  179. getStatusClass(status){
  180. const statusMap = {
  181. 1: 'pending',
  182. 2: 'verifying',
  183. 3: 'verified',
  184. };
  185. return statusMap[status] || '';
  186. },
  187. getStatusText(status) {
  188. const statusMap = {
  189. 0: '核销中',
  190. 1: '已提交'
  191. };
  192. return statusMap[status] || '未知';
  193. },
  194. changeTab(tabKey) {
  195. if (this.currentTab === tabKey) return;
  196. this.currentTab = tabKey;
  197. if(this.currentTab ==1){
  198. this.getReadyData(true);
  199. }else{
  200. if(this.currentTab == 4){
  201. this.itemByDetail();
  202. return;
  203. }
  204. this.fetchRecords(true); // 切换tab时重新加载数据
  205. }
  206. },
  207. getReadyData(isRefresh = false) {
  208. queryPendingWriteOffRecord({pageIndex:this.pagination.page,pageSize:100,ywyName:this.searchQuery}).then(res=>{
  209. this.pendingList = res.data.records?res.data.records:[];
  210. })
  211. },
  212. async fetchRecords(isRefresh = false) {
  213. if (this.isLoading || (this.loadStatus === 'noMore' && !isRefresh)) {
  214. return;
  215. }
  216. if (isRefresh) {
  217. this.pagination.page = 1;
  218. this.recordList = [];
  219. this.loadStatus = 'more';
  220. }
  221. this.isLoading = true;
  222. this.loadStatus = 'loading';
  223. let data = {};
  224. if(this.currentTab !== -1){
  225. data.status = this.currentTab-2;
  226. }
  227. data.startTime = this.startTime;
  228. data.endTime = this.endTime;
  229. data.pageIndex = this.pagination.page
  230. data.pageSize = this.pagination.limit
  231. queryHexiaoRecord(data).then(res=>{
  232. let finalData = res.data.records;
  233. if(!finalData){
  234. finalData = [];
  235. }
  236. if (finalData.length > 0) {
  237. this.recordList = [...this.recordList, ...finalData];
  238. this.pagination.page++;
  239. this.loadStatus = 'more';
  240. } else {
  241. this.loadStatus = 'noMore';
  242. }
  243. this.isLoading = false;
  244. uni.stopPullDownRefresh();
  245. });
  246. },
  247. detail(id,type){
  248. if(type == 1){
  249. uni.navigateTo({ url: `/pages/hexiao/jxs/hexiao_pending_detail?id=`+id });
  250. return;
  251. }
  252. uni.navigateTo({ url: `/pages/hexiao/jxs/hexiao_detail?id=`+id });
  253. },
  254. loadMore() {
  255. this.fetchRecords();
  256. },
  257. clearSearch(){
  258. this.startTime = "";
  259. this.endTime = "";
  260. this.startTimeXd = "";
  261. this.handleSearch()
  262. },
  263. handleSearch() {
  264. this.fetchRecords(true);
  265. },
  266. verify(id) {
  267. let title = "确认核销该订单吗?";
  268. if(id == -1){
  269. title = "一键核销";
  270. }
  271. uni.showModal({
  272. title: '提示',
  273. content: title,
  274. success: (res) => {
  275. if (res.confirm) {
  276. doCommitToChang(id).then(res=>{
  277. if(res.code === 0){
  278. this.getReadyData(true);
  279. uni.showToast({ title: '核销成功' });
  280. }else{
  281. uni.showToast({ title: '核销失败' });
  282. }
  283. });
  284. }
  285. }
  286. });
  287. },
  288. itemByDetail() {
  289. queryWriteOffDetailByItem({}).then(res=>{
  290. this.hexiaoList = res.data;
  291. })
  292. }
  293. }
  294. }
  295. </script>
  296. <style lang="scss" scoped>
  297. .page-container {
  298. display: flex;
  299. flex-direction: column;
  300. height: 100vh;
  301. background-color: #f5f6fa;
  302. }
  303. .sticky-header {
  304. position: sticky;
  305. top: 0;
  306. z-index: 100;
  307. background-color: #f5f6fa;
  308. }
  309. .search-wrapper {
  310. padding: 20rpx;
  311. background-color: #ffffff;
  312. }
  313. .search-bar {
  314. display: flex;
  315. align-items: center;
  316. background-color: #f5f6fa;
  317. border-radius: 50rpx;
  318. padding: 0 25rpx;
  319. height: 70rpx;
  320. }
  321. .search-input { flex: 1; font-size: 28rpx; margin-left: 15rpx; }
  322. .placeholder { color: #b0b0b0; }
  323. .tabs-wrapper {
  324. display: flex;
  325. background-color: #ffffff;
  326. border-bottom: 1rpx solid #f0f0f0;
  327. .tab-item {
  328. flex: 1;
  329. text-align: center;
  330. padding: 25rpx 0;
  331. font-size: 28rpx;
  332. color: #666;
  333. position: relative;
  334. &.active {
  335. color: #3c82f8;
  336. font-weight: 500;
  337. &::after {
  338. content: '';
  339. position: absolute;
  340. bottom: 0;
  341. left: 50%;
  342. transform: translateX(-50%);
  343. width: 60rpx;
  344. height: 6rpx;
  345. background-color: #3c82f8;
  346. border-radius: 3rpx;
  347. }
  348. }
  349. }
  350. }
  351. .list-container {
  352. flex: 1;
  353. height: 100%;
  354. }
  355. .empty-list { text-align: center; color: #999; padding-top: 150rpx; }
  356. .record-card {
  357. background-color: #ffffff;
  358. border-radius: 16rpx;
  359. margin: 20rpx;
  360. padding: 30rpx;
  361. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
  362. position: relative;
  363. }
  364. .card-header {
  365. display: flex;
  366. align-items: center;
  367. padding-bottom: 20rpx;
  368. border-bottom: 1rpx solid #f5f5f5;
  369. .record-id {
  370. font-size: 30rpx;
  371. font-weight: bold;
  372. color: #333;
  373. margin-left: 15rpx;
  374. }
  375. }
  376. .status-badge {
  377. position: absolute;
  378. top: 0;
  379. right: 0;
  380. padding: 8rpx 20rpx;
  381. font-size: 24rpx;
  382. color: #fff;
  383. border-top-right-radius: 16rpx;
  384. border-bottom-left-radius: 16rpx;
  385. &.pending { background-color: #3c82f8; }
  386. &.verifying { background-color: #ff9900; }
  387. &.verified { background-color: #909399; }
  388. }
  389. .card-body {
  390. padding-top: 10rpx;
  391. }
  392. .detail-row {
  393. display: flex;
  394. justify-content: space-between;
  395. align-items: center;
  396. padding: 12rpx 0;
  397. font-size: 28rpx;
  398. .detail-label { color: #666; }
  399. .detail-value { color: #333; }
  400. &.product-item {
  401. .detail-label { color: #333; }
  402. .detail-value { color: #999; }
  403. }
  404. }
  405. .card-footer {
  406. display: flex;
  407. justify-content: flex-end;
  408. margin-top: 20rpx;
  409. }
  410. .verify-btn {
  411. background-color: #3c82f8;
  412. color: #fff;
  413. font-size: 26rpx;
  414. padding: 0 30rpx;
  415. height: 60rpx;
  416. line-height: 60rpx;
  417. border-radius: 30rpx;
  418. margin: 0;
  419. &::after { border: none; }
  420. }
  421. .query-btn {
  422. background-color: #409eff;
  423. color: #fff;
  424. padding: 20rpx;
  425. border-radius: 10rpx;
  426. height: 34rpx;
  427. display: flex;
  428. justify-content: center;
  429. align-items: center;
  430. }
  431. .query-btn-icon {
  432. height: 32rpx;
  433. width: 32rpx;
  434. background-image:
  435. url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/queryIoc.png");
  436. background-size: cover;
  437. background-position: center;
  438. background-repeat: no-repeat;
  439. }
  440. .query-btn-text {
  441. font-weight: 400;
  442. font-size: 30rpx;
  443. color: #F5F5F5;
  444. }
  445. .fixed-footer {
  446. position: fixed;
  447. bottom: 0;
  448. left: 0;
  449. width: 100%;
  450. background-color: #f5f6fa;
  451. padding: 20rpx 30rpx;
  452. padding-bottom: calc(20rpx + constant(safe-area-inset-bottom));
  453. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  454. box-sizing: border-box;
  455. z-index: 100;
  456. }
  457. .add-btn {
  458. background-color: #3c82f8;
  459. color: white;
  460. border-radius: 50rpx;
  461. font-size: 32rpx;
  462. height: 90rpx;
  463. line-height: 90rpx;
  464. &::after { border: none; }
  465. }
  466. .data-display-container {
  467. padding: 30rpx;
  468. font-size: 28rpx;
  469. color: #333;
  470. min-height: 100vh; /* 确保内容撑满整个视口高度 */
  471. box-sizing: border-box; /* 边框和内边距包含在元素的总宽度和高度内 */
  472. }
  473. .card {
  474. background-color: #ffffff;
  475. border-radius: 16rpx;
  476. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08); /* 更柔和的阴影 */
  477. overflow: hidden; /* 确保圆角显示 */
  478. display: flex;
  479. flex-direction: column;
  480. max-height: calc(100vh - 60rpx); /* 卡片最大高度,留出上下padding */
  481. }
  482. .header-row {
  483. display: flex;
  484. flex-direction: row;
  485. background-color: #4A90E2; /* 品牌蓝色 */
  486. color: #ffffff;
  487. font-weight: bold;
  488. padding: 24rpx 0; /* 上下内边距增加 */
  489. border-bottom: 1rpx solid rgba(255, 255, 255, 0.2); /* 浅色边框 */
  490. position: sticky; /* 头部固定 */
  491. top: 0;
  492. z-index: 10;
  493. }
  494. .header-item {
  495. flex: 1;
  496. text-align: center;
  497. padding: 0 10rpx; /* 左右内边距 */
  498. font-size: 28rpx;
  499. }
  500. .data-body-scroll {
  501. flex: 1; /* 占据剩余空间 */
  502. overflow-y: auto; /* 允许滚动 */
  503. -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
  504. }
  505. .data-row {
  506. display: flex;
  507. flex-direction: row;
  508. align-items: center; /* 垂直居中对齐 */
  509. padding: 20rpx 0; /* 上下内边距 */
  510. border-bottom: 1rpx solid #f0f0f0; /* 更细的分割线 */
  511. transition: background-color 0.2s ease; /* 鼠标悬停或点击的平滑过渡 */
  512. }
  513. .data-row:last-child {
  514. border-bottom: none; /* 最后一行没有底部边框 */
  515. }
  516. .data-row.even-row {
  517. background-color: #f9f9f9; /* 隔行变色 */
  518. }
  519. .data-row:hover {
  520. background-color: #eef7ff; /* 悬停效果 */
  521. }
  522. .data-cell {
  523. flex: 1;
  524. padding: 0 10rpx; /* 左右内边距 */
  525. text-align: center;
  526. font-size: 26rpx; /* 数据字体略小 */
  527. color: #555;
  528. word-break: break-word; /* 允许长文本在任何地方换行 */
  529. line-height: 1.4; /* 增加行高 */
  530. }
  531. .item-column {
  532. text-align: left;
  533. padding-left: 20rpx; /* 品项左边距 */
  534. color: #333;
  535. font-weight: 500;
  536. }
  537. .no-data {
  538. text-align: center;
  539. padding: 40rpx;
  540. color: #999;
  541. font-size: 30rpx;
  542. }
  543. </style>