hexiao_record.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  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--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--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. <scroll-view class="list-container" scroll-y="true" @scrolltolower="loadMore">
  38. <view v-if="recordList.length === 0 && loadStatus !== 'loading'" class="empty-list">
  39. <text>暂无相关记录</text>
  40. </view>
  41. <view v-for="record in recordList" :key="record.orderNo" class="record-card">
  42. <view class="card-header">
  43. <uni-icons type="paperclip" size="20" color="#3c82f8"></uni-icons>
  44. <text class="record-id" @click="detail(record.orderNo)" style="text-decoration: underline">{{ record.orderNo }}</text>
  45. <view class="status-badge pending" v-if="record.status === 1">
  46. {{ getStatusText(record.status) }}
  47. </view>
  48. <view class="status-badge verifying" v-if="record.status === 2">
  49. {{ getStatusText(record.status) }}
  50. </view>
  51. <view class="status-badge verified" style="background-color: #54CFAB" v-if="record.status === 3">
  52. {{ getStatusText(record.status) }}
  53. </view>
  54. </view>
  55. <view class="card-body">
  56. <view class="detail-row">
  57. <text class="detail-label">业务员名称</text>
  58. <text class="detail-value">{{ record.ywyName }}</text>
  59. </view>
  60. <view class="detail-row" v-if="record.status === 2 || record.status === 3">
  61. <text class="detail-label">申请时间</text>
  62. <text class="detail-value">{{ record. dealerApplyTime }}</text>
  63. </view>
  64. <view class="detail-row" v-if="record.status === 3">
  65. <text class="detail-label">审核时间</text>
  66. <text class="detail-value">{{ record.finishTime }}</text>
  67. </view>
  68. <view class="detail-row">
  69. <text class="detail-label">商品总数</text>
  70. <text class="detail-value">{{ record.writeOffNum }}</text>
  71. </view>
  72. <view class="detail-row product-item" v-for="(item, index) in record.writeOffRecordDetailVos" :key="index">
  73. <text class="detail-label">{{ item.categoryName }}</text>
  74. <text class="detail-value">{{ item.num }}</text>
  75. </view>
  76. </view>
  77. <view class="card-footer" v-if="record.status === 1">
  78. <button class="verify-btn" @click="verify(record.id,record.orderNo)">一键核销</button>
  79. </view>
  80. </view>
  81. <uni-load-more :status="loadStatus"></uni-load-more>
  82. </scroll-view>
  83. <u-calendar @close="timeShow = false" :show="timeShow" :mode="mode" @confirm="confirm"></u-calendar>
  84. </view>
  85. </template>
  86. <script>
  87. import {queryJxsAddRecord,doCommitToJxs,doCommitToChang, queryHexiaoRecord} from "@/api/hexiao";
  88. export default {
  89. data() {
  90. return {
  91. startTime: '',
  92. endTime: '',
  93. timeShow: false,
  94. startTimeXd:"",
  95. mode: 'range',
  96. searchQuery: '',
  97. tabs: [
  98. { name: '全部', key: 'all' ,id:-1 },
  99. { name: '待核销', key: 'pending',id: 1 },
  100. { name: '核销中', key: 'verifying', id: 2},
  101. { name: '已核销', key: 'verified' , id :3},
  102. ],
  103. currentTab: -1,
  104. recordList: [],
  105. pagination: { page: 1, limit: 10 },
  106. loadStatus: 'more', // 'more', 'loading', 'noMore'
  107. isLoading: false,
  108. };
  109. },
  110. onLoad() {
  111. this.fetchRecords(true);
  112. },
  113. onPullDownRefresh() {
  114. this.fetchRecords(true);
  115. },
  116. methods: {
  117. confirm(e) {
  118. this.startTime = e[0];
  119. this.endTime = e[e.length-1];
  120. this.startTimeXd = e[0]+' ~ '+e[e.length-1];
  121. if(!this.show){
  122. this.handleSearch()
  123. }
  124. this.timeShow = false;
  125. },
  126. getStatusClass(status){
  127. const statusMap = {
  128. 1: 'pending',
  129. 2: 'verifying',
  130. 3: 'verified'
  131. };
  132. return statusMap[status] || '';
  133. },
  134. getStatusText(status) {
  135. const statusMap = {
  136. 1: '待核销',
  137. 2: '核销中',
  138. 3: '已核销'
  139. };
  140. return statusMap[status] || '未知';
  141. },
  142. changeTab(tabKey) {
  143. if (this.currentTab === tabKey) return;
  144. this.currentTab = tabKey;
  145. this.fetchRecords(true); // 切换tab时重新加载数据
  146. },
  147. async fetchRecords(isRefresh = false) {
  148. if (this.isLoading || (this.loadStatus === 'noMore' && !isRefresh)) {
  149. return;
  150. }
  151. if (isRefresh) {
  152. this.pagination.page = 1;
  153. this.recordList = [];
  154. this.loadStatus = 'more';
  155. }
  156. this.isLoading = true;
  157. this.loadStatus = 'loading';
  158. let data = {};
  159. if(this.currentTab !== -1){
  160. data.status = this.currentTab;
  161. }
  162. data.startTime = this.startTime;
  163. data.endTime = this.endTime;
  164. data.pageIndex = this.pagination.page
  165. data.pageSize = this.pagination.limit
  166. queryHexiaoRecord(data).then(res=>{
  167. let finalData = res.data.records;
  168. if(!finalData){
  169. finalData = [];
  170. }
  171. if (finalData.length > 0) {
  172. this.recordList = [...this.recordList, ...finalData];
  173. this.pagination.page++;
  174. this.loadStatus = 'more';
  175. } else {
  176. this.loadStatus = 'noMore';
  177. }
  178. this.isLoading = false;
  179. uni.stopPullDownRefresh();
  180. });
  181. },
  182. detail(id){
  183. uni.navigateTo({ url: `/pages/cjx/hexiao/jxs/hexiao_detail?id=`+id });
  184. },
  185. loadMore() {
  186. this.fetchRecords();
  187. },
  188. clearSearch(){
  189. this.startTime = "";
  190. this.endTime = "";
  191. this.startTimeXd = "";
  192. this.handleSearch()
  193. },
  194. handleSearch() {
  195. this.fetchRecords(true);
  196. },
  197. verify(id,orderNo) {
  198. uni.showModal({
  199. title: '提示',
  200. content: `确认核销订单 ${orderNo} 吗?`,
  201. success: (res) => {
  202. if (res.confirm) {
  203. doCommitToChang(id).then(res=>{
  204. if(res.code === 0){
  205. this.fetchRecords(true);
  206. uni.showToast({ title: '核销成功' });
  207. }else{
  208. uni.showToast({ title: '核销失败' });
  209. }
  210. });
  211. }
  212. }
  213. });
  214. }
  215. }
  216. }
  217. </script>
  218. <style lang="scss" scoped>
  219. .page-container {
  220. display: flex;
  221. flex-direction: column;
  222. height: 100vh;
  223. background-color: #f5f6fa;
  224. }
  225. .sticky-header {
  226. position: sticky;
  227. top: 0;
  228. z-index: 100;
  229. background-color: #f5f6fa;
  230. }
  231. .search-wrapper {
  232. padding: 20rpx;
  233. background-color: #ffffff;
  234. }
  235. .search-bar {
  236. display: flex;
  237. align-items: center;
  238. background-color: #f5f6fa;
  239. border-radius: 50rpx;
  240. padding: 0 25rpx;
  241. height: 70rpx;
  242. }
  243. .search-input { flex: 1; font-size: 28rpx; margin-left: 15rpx; }
  244. .placeholder { color: #b0b0b0; }
  245. .tabs-wrapper {
  246. display: flex;
  247. background-color: #ffffff;
  248. border-bottom: 1rpx solid #f0f0f0;
  249. .tab-item {
  250. flex: 1;
  251. text-align: center;
  252. padding: 25rpx 0;
  253. font-size: 28rpx;
  254. color: #666;
  255. position: relative;
  256. &.active {
  257. color: #3c82f8;
  258. font-weight: 500;
  259. &::after {
  260. content: '';
  261. position: absolute;
  262. bottom: 0;
  263. left: 50%;
  264. transform: translateX(-50%);
  265. width: 60rpx;
  266. height: 6rpx;
  267. background-color: #3c82f8;
  268. border-radius: 3rpx;
  269. }
  270. }
  271. }
  272. }
  273. .list-container {
  274. flex: 1;
  275. height: 100%;
  276. }
  277. .empty-list { text-align: center; color: #999; padding-top: 150rpx; }
  278. .record-card {
  279. background-color: #ffffff;
  280. border-radius: 16rpx;
  281. margin: 20rpx;
  282. padding: 30rpx;
  283. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
  284. position: relative;
  285. }
  286. .card-header {
  287. display: flex;
  288. align-items: center;
  289. padding-bottom: 20rpx;
  290. border-bottom: 1rpx solid #f5f5f5;
  291. .record-id {
  292. font-size: 30rpx;
  293. font-weight: bold;
  294. color: #333;
  295. margin-left: 15rpx;
  296. }
  297. }
  298. .status-badge {
  299. position: absolute;
  300. top: 0;
  301. right: 0;
  302. padding: 8rpx 20rpx;
  303. font-size: 24rpx;
  304. color: #fff;
  305. border-top-right-radius: 16rpx;
  306. border-bottom-left-radius: 16rpx;
  307. &.pending { background-color: #3c82f8; }
  308. &.verifying { background-color: #ff9900; }
  309. &.verified { background-color: #909399; }
  310. }
  311. .card-body {
  312. padding-top: 10rpx;
  313. }
  314. .detail-row {
  315. display: flex;
  316. justify-content: space-between;
  317. align-items: center;
  318. padding: 12rpx 0;
  319. font-size: 28rpx;
  320. .detail-label { color: #666; }
  321. .detail-value { color: #333; }
  322. &.product-item {
  323. .detail-label { color: #333; }
  324. .detail-value { color: #999; }
  325. }
  326. }
  327. .card-footer {
  328. display: flex;
  329. justify-content: flex-end;
  330. margin-top: 20rpx;
  331. }
  332. .verify-btn {
  333. background-color: #3c82f8;
  334. color: #fff;
  335. font-size: 26rpx;
  336. padding: 0 30rpx;
  337. height: 60rpx;
  338. line-height: 60rpx;
  339. border-radius: 30rpx;
  340. margin: 0;
  341. &::after { border: none; }
  342. }
  343. .query-btn {
  344. background-color: #409eff;
  345. color: #fff;
  346. padding: 20rpx;
  347. border-radius: 10rpx;
  348. height: 34rpx;
  349. display: flex;
  350. justify-content: center;
  351. align-items: center;
  352. }
  353. .query-btn-icon {
  354. height: 32rpx;
  355. width: 32rpx;
  356. background-image:
  357. url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/queryIoc.png");
  358. background-size: cover;
  359. background-position: center;
  360. background-repeat: no-repeat;
  361. }
  362. .query-btn-text {
  363. font-weight: 400;
  364. font-size: 30rpx;
  365. color: #F5F5F5;
  366. }
  367. </style>