hexiao_record.vue 10 KB

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