Browse Source

回收订单统计页面接口对接

Alex 9 months ago
parent
commit
dcd09ae596

+ 7 - 7
src/components/CommonPage/CommonTable.vue

@@ -30,6 +30,7 @@
   import { EleMessage } from 'ele-admin-plus/es';
   import { useDictData } from '@/utils/use-dict-data';
   import { download, toFormData, checkDownloadRes } from '@/utils/common';
+import { method } from 'lodash-es';
 
   const slotArray = useSlots();
 
@@ -43,7 +44,6 @@
       })
     },
     pageUrl: { type: String, default: '/system/post/list' },
-    exportUrl: { type: String, default: '/system/post/export' },
     columns: { type: Array, default: () => [] },
     bodyStyle: { type: Object, default: () => ({}) },
     flexTable: { type: Boolean, default: true }
@@ -112,10 +112,10 @@
   };
 
   /// 导出数据
-  async function exportPage(params, name) {
+  async function exportPage(params, name, method = 'POST') {
     const res = await proxy.$http({
       url: props.pageConfig.exportUrl,
-      method: 'POST',
+      method,
       data: toFormData(params),
       responseType: 'blob'
     });
@@ -127,22 +127,22 @@
   }
 
   //导出数据 进导出记录
-  function exportRecord(params, name) {
+  function exportRecord(params, method = 'POST') {
     return proxy.$http({
       url: props.pageConfig.exportUrl,
-      method: 'POST',
+      method,
       data: params
     }); // 导出记录
   }
 
   /** 导出数据 */
-  const exportData = (name) => {
+  const exportData = (method = 'POST') => {
     const loading = EleMessage.loading({
       message: '请求中..',
       plain: true
     });
     tableRef.value?.fetch?.(({ where, orders }) => {
-      exportRecord({ ...where, ...orders }, name)
+      exportRecord({ ...where, ...orders }, method)
         .then((res) => {
           if (res.data.code === 200) {
             EleMessage.success('操作成功,请前往导出记录下载');

+ 4 - 5
src/views/statistic/recycleOrder/components/page-search.vue

@@ -5,7 +5,6 @@
       :items="formItems"
       ref="searchRef"
       @search="search"
-      @reset="reset"
       :offset="1"
     ></ProSearch>
   </ele-card>
@@ -29,8 +28,8 @@
           format: 'YYYY-MM-DD',
           valueFormat: 'YYYY-MM-DD',
           onChange: (value) => {
-            initKeys.startTime = value ? value[0] : '';
-            initKeys.endTime = value ? value[1] : '';
+            initKeys.statisticDateStart = value ? value[0] : '';
+            initKeys.statisticDateEnd = value ? value[1] : '';
             searchRef.value?.setData(initKeys);
           }
         },
@@ -54,8 +53,8 @@
   });
 
   const initKeys = reactive({
-    startTime: '',
-    endTime: '',
+    statisticDateStart: '',
+    statisticDateEnd: '',
     godownId: ''
   });
 

+ 8 - 9
src/views/statistic/recycleOrder/index.vue

@@ -29,30 +29,29 @@
   import { ref, reactive } from 'vue';
   import CommonTable from '@/components/CommonPage/CommonTable.vue';
   import pageSearch from './components/page-search.vue';
-  import { useDictData } from '@/utils/use-dict-data';
 
   defineOptions({ name: 'recycleOrder' });
 
   /** 表格列配置 */
   const columns = ref([
-    { type: 'index', label: '#', align: 'center',width:80 },
-    { label: '日期', prop: 'createTime', align: 'center' },
+    { type: 'index', label: '#', align: 'center', width: 80 },
+    { label: '日期', prop: 'statisticDate', align: 'center' },
     { label: '仓库', prop: 'godownName', align: 'center' },
     { label: '回收订单数', prop: 'orderNum', align: 'center' },
     { label: '回收本数', prop: 'bookNum', align: 'center' },
-    { label: '回收平均价格', prop: 'price', align: 'center' },
+    { label: '回收平均价格', prop: 'recycleAveragePrice', align: 'center' },
     { label: '审核订单数', prop: 'auditNum', align: 'center' },
-    { label: '审核金额', prop: 'amount', align: 'center' }
+    { label: '审核金额', prop: 'auditMoney', align: 'center' }
   ]);
 
   /** 页面组件实例 */
   const pageRef = ref(null);
 
   const pageConfig = reactive({
-    pageUrl: '/baseinfo/godown/pagelist',
-    exportUrl: '/baseinfo/godown/export',
+    pageUrl: '/order/recycleOrderStatistic/pagelist',
+    exportUrl: '/order/recycleOrderStatistic/export',
     fileName: '回收订单统计',
-    cacheKey: 'recycleOrderTable'
+    cacheKey: 'recycleOrderStatisticTable'
   });
 
   //刷新表格
@@ -62,6 +61,6 @@
 
   //导出excel
   function handleExportExcel() {
-    pageRef.value?.exportData('回收订单统计');
+    pageRef.value?.exportData('GET');
   }
 </script>