hexiao_record.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  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">
  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. <u-calendar min-date="2025-07-01" max-date="2030-07-01" @close="timeShow = false" :show="timeShow" :mode="mode" @confirm="confirm"></u-calendar>
  107. </view>
  108. </template>
  109. <script>
  110. import {queryJxsAddRecord,doCommitToJxs,doCommitToChang, queryHexiaoRecord} from "@/api/hexiao";
  111. import {queryPendingWriteOffRecord} from "../../../api/hexiao";
  112. export default {
  113. data() {
  114. return {
  115. startTime: '',
  116. endTime: '',
  117. timeShow: false,
  118. startTimeXd:"",
  119. mode: 'range',
  120. searchQuery: '',
  121. tabs: [
  122. { name: '待审核', key: 'pending',id: 1 },
  123. { name: '核销中', key: 'verifying', id: 2},
  124. { name: '已核销', key: 'verified' , id :3},
  125. ],
  126. currentTab: 1,
  127. recordList: [],
  128. pendingList:[],
  129. pagination: { page: 1, limit: 10 },
  130. loadStatus: 'more', // 'more', 'loading', 'noMore'
  131. isLoading: false,
  132. };
  133. },
  134. onLoad() {
  135. this.getReadyData(true);
  136. },
  137. onPullDownRefresh() {
  138. this.fetchRecords(true);
  139. },
  140. methods: {
  141. confirm(e) {
  142. this.startTime = e[0];
  143. this.endTime = e[e.length-1];
  144. this.startTimeXd = e[0]+' ~ '+e[e.length-1];
  145. if(!this.show){
  146. this.handleSearch()
  147. }
  148. this.timeShow = false;
  149. },
  150. getStatusClass(status){
  151. const statusMap = {
  152. 1: 'pending',
  153. 2: 'verifying',
  154. 3: 'verified'
  155. };
  156. return statusMap[status] || '';
  157. },
  158. getStatusText(status) {
  159. const statusMap = {
  160. 0: '核销中',
  161. 1: '已核销'
  162. };
  163. return statusMap[status] || '未知';
  164. },
  165. changeTab(tabKey) {
  166. if (this.currentTab === tabKey) return;
  167. this.currentTab = tabKey;
  168. if(this.currentTab ==1){
  169. this.getReadyData(true);
  170. }else{
  171. this.fetchRecords(true); // 切换tab时重新加载数据
  172. }
  173. },
  174. getReadyData(isRefresh = false) {
  175. queryPendingWriteOffRecord({pageIndex:this.pagination.page,pageSize:100,ywyName:this.searchQuery}).then(res=>{
  176. this.pendingList = res.data.records?res.data.records:[];
  177. })
  178. },
  179. async fetchRecords(isRefresh = false) {
  180. if (this.isLoading || (this.loadStatus === 'noMore' && !isRefresh)) {
  181. return;
  182. }
  183. if (isRefresh) {
  184. this.pagination.page = 1;
  185. this.recordList = [];
  186. this.loadStatus = 'more';
  187. }
  188. this.isLoading = true;
  189. this.loadStatus = 'loading';
  190. let data = {};
  191. if(this.currentTab !== -1){
  192. data.status = this.currentTab-2;
  193. }
  194. data.startTime = this.startTime;
  195. data.endTime = this.endTime;
  196. data.pageIndex = this.pagination.page
  197. data.pageSize = this.pagination.limit
  198. queryHexiaoRecord(data).then(res=>{
  199. let finalData = res.data.records;
  200. if(!finalData){
  201. finalData = [];
  202. }
  203. if (finalData.length > 0) {
  204. this.recordList = [...this.recordList, ...finalData];
  205. this.pagination.page++;
  206. this.loadStatus = 'more';
  207. } else {
  208. this.loadStatus = 'noMore';
  209. }
  210. this.isLoading = false;
  211. uni.stopPullDownRefresh();
  212. });
  213. },
  214. detail(id,type){
  215. if(type == 1){
  216. uni.navigateTo({ url: `/pages/hexiao/jxs/hexiao_pending_detail?id=`+id });
  217. return;
  218. }
  219. uni.navigateTo({ url: `/pages/hexiao/jxs/hexiao_detail?id=`+id });
  220. },
  221. loadMore() {
  222. this.fetchRecords();
  223. },
  224. clearSearch(){
  225. this.startTime = "";
  226. this.endTime = "";
  227. this.startTimeXd = "";
  228. this.handleSearch()
  229. },
  230. handleSearch() {
  231. this.fetchRecords(true);
  232. },
  233. verify(id) {
  234. let title = "确认核销该订单吗?";
  235. if(id == -1){
  236. title = "一键核销";
  237. }
  238. uni.showModal({
  239. title: '提示',
  240. content: title,
  241. success: (res) => {
  242. if (res.confirm) {
  243. doCommitToChang(id).then(res=>{
  244. if(res.code === 0){
  245. this.getReadyData(true);
  246. uni.showToast({ title: '核销成功' });
  247. }else{
  248. uni.showToast({ title: '核销失败' });
  249. }
  250. });
  251. }
  252. }
  253. });
  254. }
  255. }
  256. }
  257. </script>
  258. <style lang="scss" scoped>
  259. .page-container {
  260. display: flex;
  261. flex-direction: column;
  262. height: 100vh;
  263. background-color: #f5f6fa;
  264. }
  265. .sticky-header {
  266. position: sticky;
  267. top: 0;
  268. z-index: 100;
  269. background-color: #f5f6fa;
  270. }
  271. .search-wrapper {
  272. padding: 20rpx;
  273. background-color: #ffffff;
  274. }
  275. .search-bar {
  276. display: flex;
  277. align-items: center;
  278. background-color: #f5f6fa;
  279. border-radius: 50rpx;
  280. padding: 0 25rpx;
  281. height: 70rpx;
  282. }
  283. .search-input { flex: 1; font-size: 28rpx; margin-left: 15rpx; }
  284. .placeholder { color: #b0b0b0; }
  285. .tabs-wrapper {
  286. display: flex;
  287. background-color: #ffffff;
  288. border-bottom: 1rpx solid #f0f0f0;
  289. .tab-item {
  290. flex: 1;
  291. text-align: center;
  292. padding: 25rpx 0;
  293. font-size: 28rpx;
  294. color: #666;
  295. position: relative;
  296. &.active {
  297. color: #3c82f8;
  298. font-weight: 500;
  299. &::after {
  300. content: '';
  301. position: absolute;
  302. bottom: 0;
  303. left: 50%;
  304. transform: translateX(-50%);
  305. width: 60rpx;
  306. height: 6rpx;
  307. background-color: #3c82f8;
  308. border-radius: 3rpx;
  309. }
  310. }
  311. }
  312. }
  313. .list-container {
  314. flex: 1;
  315. height: 100%;
  316. }
  317. .empty-list { text-align: center; color: #999; padding-top: 150rpx; }
  318. .record-card {
  319. background-color: #ffffff;
  320. border-radius: 16rpx;
  321. margin: 20rpx;
  322. padding: 30rpx;
  323. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
  324. position: relative;
  325. }
  326. .card-header {
  327. display: flex;
  328. align-items: center;
  329. padding-bottom: 20rpx;
  330. border-bottom: 1rpx solid #f5f5f5;
  331. .record-id {
  332. font-size: 30rpx;
  333. font-weight: bold;
  334. color: #333;
  335. margin-left: 15rpx;
  336. }
  337. }
  338. .status-badge {
  339. position: absolute;
  340. top: 0;
  341. right: 0;
  342. padding: 8rpx 20rpx;
  343. font-size: 24rpx;
  344. color: #fff;
  345. border-top-right-radius: 16rpx;
  346. border-bottom-left-radius: 16rpx;
  347. &.pending { background-color: #3c82f8; }
  348. &.verifying { background-color: #ff9900; }
  349. &.verified { background-color: #909399; }
  350. }
  351. .card-body {
  352. padding-top: 10rpx;
  353. }
  354. .detail-row {
  355. display: flex;
  356. justify-content: space-between;
  357. align-items: center;
  358. padding: 12rpx 0;
  359. font-size: 28rpx;
  360. .detail-label { color: #666; }
  361. .detail-value { color: #333; }
  362. &.product-item {
  363. .detail-label { color: #333; }
  364. .detail-value { color: #999; }
  365. }
  366. }
  367. .card-footer {
  368. display: flex;
  369. justify-content: flex-end;
  370. margin-top: 20rpx;
  371. }
  372. .verify-btn {
  373. background-color: #3c82f8;
  374. color: #fff;
  375. font-size: 26rpx;
  376. padding: 0 30rpx;
  377. height: 60rpx;
  378. line-height: 60rpx;
  379. border-radius: 30rpx;
  380. margin: 0;
  381. &::after { border: none; }
  382. }
  383. .query-btn {
  384. background-color: #409eff;
  385. color: #fff;
  386. padding: 20rpx;
  387. border-radius: 10rpx;
  388. height: 34rpx;
  389. display: flex;
  390. justify-content: center;
  391. align-items: center;
  392. }
  393. .query-btn-icon {
  394. height: 32rpx;
  395. width: 32rpx;
  396. background-image:
  397. url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/queryIoc.png");
  398. background-size: cover;
  399. background-position: center;
  400. background-repeat: no-repeat;
  401. }
  402. .query-btn-text {
  403. font-weight: 400;
  404. font-size: 30rpx;
  405. color: #F5F5F5;
  406. }
  407. .fixed-footer {
  408. position: fixed;
  409. bottom: 0;
  410. left: 0;
  411. width: 100%;
  412. background-color: #f5f6fa;
  413. padding: 20rpx 30rpx;
  414. padding-bottom: calc(20rpx + constant(safe-area-inset-bottom));
  415. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  416. box-sizing: border-box;
  417. z-index: 100;
  418. }
  419. .add-btn {
  420. background-color: #3c82f8;
  421. color: white;
  422. border-radius: 50rpx;
  423. font-size: 32rpx;
  424. height: 90rpx;
  425. line-height: 90rpx;
  426. &::after { border: none; }
  427. }
  428. </style>