Bläddra i källkod

财务审核页面合计行

wangxy 18 timmar sedan
förälder
incheckning
0c4cdc3fa1

+ 40 - 17
src/views/store/externalOrder/index.vue

@@ -6,6 +6,7 @@
       <el-tab-pane label="审核通过" name="2"></el-tab-pane>
       <el-tab-pane label="已发货" name="3"></el-tab-pane>
       <el-tab-pane label="已回款" name="4"></el-tab-pane>
+      <el-tab-pane label="订单拒收" name="-4"></el-tab-pane>
       <el-tab-pane label="已取消" name="-3"></el-tab-pane>
     </el-tabs>
 
@@ -203,7 +204,7 @@
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table ref="orderTable" v-loading="loading" border :data="orderList" style="width:100%" show-summary :summary-method="getSummaries" @filter-change="handleFilterChange">
+    <el-table :key="tableKey" ref="orderTable" v-loading="loading" border :data="orderList" row-key="orderId" style="width:100%" show-summary :summary-method="getSummaries" @filter-change="handleFilterChange">
       <el-table-column label="外部订单号" align="center" prop="orderCode" width="170" fixed="left" column-key="orderCode" :filters="getFilters('orderCode')" :filtered-value="columnFilters.orderCode" />
       <el-table-column label="会员ID" align="center" prop="userId" width="90" column-key="userId" :filters="getFilters('userId')" :filtered-value="columnFilters.userId" />
       <el-table-column label="订单状态" align="center" prop="status" width="100" column-key="status" :filters="statusFilters" :filtered-value="columnFilters.status">
@@ -212,7 +213,8 @@
           <el-tag v-else-if="scope.row.status==2" type="success" size="mini">审核通过</el-tag>
           <el-tag v-else-if="scope.row.status==3" type="primary" size="mini">已发货</el-tag>
           <el-tag v-else-if="scope.row.status==4" size="mini">已回款</el-tag>
-          <el-tag v-else-if="scope.row.status==-3" type="danger" size="mini">已取消</el-tag>
+          <el-tag v-else-if="scope.row.status==-4" type="danger" size="mini">订单拒收</el-tag>
+          <el-tag v-else-if="scope.row.status==-3" type="info" size="mini">已取消</el-tag>
           <span v-else>-</span>
         </template>
       </el-table-column>
@@ -283,7 +285,7 @@
           <el-button size="mini" type="text" v-hasPermi="['store:externalOrder:audit']" @click="handleAudit(scope.row)" v-if="scope.row.status == 1">审核</el-button>
           <el-button size="mini" type="text" v-hasPermi="['store:externalOrder:approveOrder']" @click="handleApprove(scope.row)" v-if="scope.row.status == 3 && !scope.row.isApplyAudit && isAbnormalDelivery(scope.row.deliveryType)">申请审核</el-button>
           <el-button size="mini" type="text" v-hasPermi="['store:externalOrder:express']" @click="handleExpress(scope.row)" v-if="scope.row.deliverySn">查看物流</el-button>
-          <el-button size="mini" type="text" v-hasPermi="['store:externalOrder:cancel']" @click="handleCancel(scope.row)" v-if="scope.row.status != -3">取消订单</el-button>
+          <el-button size="mini" type="text" v-hasPermi="['store:externalOrder:cancel']" @click="handleCancel(scope.row)" v-if="scope.row.status != -3 && scope.row.status != -4">取消订单</el-button>
           <el-button size="mini" type="text" v-hasPermi="['store:externalOrder:edit']" @click="handleEdit(scope.row)">订单修改</el-button>
         </template>
       </el-table-column>
@@ -447,7 +449,8 @@
           <el-tag v-else-if="detailData.status==2" type="success" size="mini">审核通过</el-tag>
           <el-tag v-else-if="detailData.status==3" type="primary" size="mini">已发货</el-tag>
           <el-tag v-else-if="detailData.status==4" size="mini">已回款</el-tag>
-          <el-tag v-else-if="detailData.status==-3" type="danger" size="mini">已取消</el-tag>
+          <el-tag v-else-if="detailData.status==-4" type="danger" size="mini">订单拒收</el-tag>
+          <el-tag v-else-if="detailData.status==-3" type="info" size="mini">已取消</el-tag>
         </el-descriptions-item>
         <el-descriptions-item label="订单类型">
           <span v-if="detailData.orderType==1">外部订单</span>
@@ -612,7 +615,7 @@
       />
     </el-dialog>
 
-    <el-dialog title="订单修改" v-if="editOpen" :visible.sync="editOpen" width="600px" append-to-body :close-on-click-modal="false">
+    <el-dialog title="订单修改" :visible.sync="editOpen" width="600px" append-to-body :close-on-click-modal="false">
       <el-form ref="editForm" :model="editForm" label-width="120px">
         <el-form-item label="订单状态">
           <el-select v-model="editForm.status" placeholder="请选择订单状态" clearable size="small" style="width:200px;">
@@ -620,6 +623,7 @@
             <el-option label="审核通过" :value="2" />
             <el-option label="已发货" :value="3" />
             <el-option label="已回款" :value="4" />
+            <el-option label="订单拒收" :value="-4" />
             <el-option label="已取消" :value="-3" />
           </el-select>
         </el-form-item>
@@ -708,7 +712,9 @@ export default {
       exportLoading: false,
       showSearch: true,
       total: 0,
+      tableKey: 0,
       orderList: [],
+      summaryData: {},
       companyList: [],
       open: false,
       title: "",
@@ -790,6 +796,7 @@ export default {
         rejectReturnTimeStart: null,
         rejectReturnTimeEnd: null,
         // 以下为列头筛选用字段
+        status: null,
         orderType: null,
         payType: null,
         userName: null,
@@ -851,7 +858,7 @@ export default {
       userStatusOptions: [],
       deptOptions: [],
       // 列头筛选-枚举字段展示文案映射
-      statusMap: { 1: '未审核', 2: '审核通过', 3: '已发货', 4: '已回款', '-3': '已取消' },
+      statusMap: { 1: '未审核', 2: '审核通过', 3: '已发货', 4: '已回款', '-4': '订单拒收', '-3': '已取消' },
       orderTypeMap: { 1: '外部订单', 2: '套餐包', 3: '问诊', 4: '积分' },
       memberSexMap: { 1: '男', 2: '女' },
       // 列头筛选-各列选中值(单选语义,用数组承载以适配 Element filtered-value)
@@ -962,8 +969,12 @@ export default {
       listExternalOrder(params).then(response => {
         this.orderList = response.rows;
         this.total = response.total;
-        this.loading = false;
-      }).catch(() => {
+        this.summaryData = response.summary || {};
+        // 强制表格重新渲染,避免 :filters 动态变化时 Element UI 内部 DOM 操作冲突(insertBefore 错误)
+        this.tableKey++;
+      }).catch((err) => {
+        console.error('外部订单列表加载失败:', err);
+      }).finally(() => {
         this.loading = false;
       });
     },
@@ -1032,7 +1043,10 @@ export default {
           this.queryParams[fieldName] = last;
         }
       });
-      this.handleQuery();
+      // 延迟到下一个 tick 再查询,等筛选面板关闭后再更新表格数据,避免 insertBefore DOM 错误
+      this.$nextTick(() => {
+        this.handleQuery();
+      });
     },
     /** 重置所有列头筛选选中状态 */
     resetColumnFilters() {
@@ -1040,8 +1054,8 @@ export default {
         this.columnFilters[key] = [];
       });
     },
-    /** 合计行:对金额/数量列求和(基于当前页数据) */
-    getSummaries({ columns, data }) {
+    /** 合计行:使用后端返回的整个数据集汇总(非当前页) */
+    getSummaries({ columns }) {
       const sums = [];
       const sumProps = ['totalPrice', 'receivablePrice', 'payPrice', 'collectionPrice', 'refundPrice', 'memberBuyCount'];
       columns.forEach((column, index) => {
@@ -1050,11 +1064,13 @@ export default {
           return;
         }
         if (sumProps.includes(column.property)) {
-          const total = data.reduce((sum, row) => {
-            const v = Number(row[column.property]);
-            return isNaN(v) ? sum : sum + v;
-          }, 0);
-          sums[index] = column.property === 'memberBuyCount' ? total : total.toFixed(2);
+          const v = this.summaryData ? this.summaryData[column.property] : null;
+          if (v === null || v === undefined || v === '') {
+            sums[index] = '';
+          } else {
+            const num = Number(v);
+            sums[index] = isNaN(num) ? '' : (column.property === 'memberBuyCount' ? num : num.toFixed(2));
+          }
         } else {
           sums[index] = '';
         }
@@ -1505,8 +1521,15 @@ export default {
           this.msgSuccess("修改成功");
           this.editConfirmOpen = false;
           this.editOpen = false;
-          this.getList();
+          this.$nextTick(() => {
+            this.getList();
+          });
+        } else {
+          this.msgError(response.msg || "修改失败");
         }
+      }).catch((err) => {
+        console.error('订单修改失败:', err);
+        this.editConfirmOpen = false;
       });
     }
   }

+ 30 - 17
src/views/store/financeOrder/index.vue

@@ -126,7 +126,7 @@
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" border :data="orderList" style="width:100%" show-summary :summary-method="getSummaries" @filter-change="handleFilterChange">
+    <el-table :key="tableKey" v-loading="loading" border :data="orderList" row-key="orderId" style="width:100%" show-summary :summary-method="getSummaries" @filter-change="handleFilterChange">
       <el-table-column label="订单编号" align="center" prop="orderCode" width="170" fixed="left" column-key="orderCode" :filters="getFilters('orderCode')" :filtered-value="columnFilters.orderCode" />
       <el-table-column label="订单日期" align="center" prop="externalCreateTime" width="160" column-key="externalCreateTime" :filters="getFilters('externalCreateTime')" :filtered-value="columnFilters.externalCreateTime">
         <template slot-scope="scope">
@@ -258,8 +258,10 @@ export default {
       loading: false,
       exportLoading: false,
       showSearch: true,
+      tableKey: 0,
       total: 0,
       orderList: [],
+      summaryData: {},
       deliveryTime: null,
       createTime: null,
       returnTime: null,
@@ -349,8 +351,11 @@ export default {
       listFinanceOrder(params).then(response => {
         this.orderList = response.rows || []
         this.total = response.total || 0
-        this.loading = false
+        this.summaryData = response.summary || {}
+        // 强制表格重新渲染,避免 :filters 动态变化时 Element UI 不更新筛选下拉项
+        this.tableKey++
       }).catch(() => {
+      }).finally(() => {
         this.loading = false
       })
     },
@@ -409,26 +414,28 @@ export default {
         this.columnFilters[key] = [];
       });
     },
-    /** 合计行:对金额列求和(基于当前页数据) */
-    getSummaries({ columns, data }) {
-      const sums = [];
-      const sumProps = ['totalPrice', 'collectionPrice', 'returnPrice'];
+    /** 合计行:使用后端返回的整个数据集汇总(非当前页) */
+    getSummaries({ columns }) {
+      const sums = []
+      const sumProps = ['totalPrice', 'collectionPrice', 'returnPrice']
       columns.forEach((column, index) => {
         if (index === 0) {
-          sums[index] = '总计';
-          return;
+          sums[index] = '总计'
+          return
         }
         if (sumProps.includes(column.property)) {
-          const total = data.reduce((sum, row) => {
-            const v = Number(row[column.property]);
-            return isNaN(v) ? sum : sum + v;
-          }, 0);
-          sums[index] = total.toFixed(2);
+          const v = this.summaryData ? this.summaryData[column.property] : null
+          if (v === null || v === undefined || v === '') {
+            sums[index] = ''
+          } else {
+            const num = Number(v)
+            sums[index] = isNaN(num) ? '' : num.toFixed(2)
+          }
         } else {
-          sums[index] = '';
+          sums[index] = ''
         }
-      });
-      return sums;
+      })
+      return sums
     },
     handleDeliveryTimeChange(val) {
       if (val) {
@@ -482,7 +489,13 @@ export default {
         type: 'warning'
       }).then(() => {
         this.exportLoading = true
-        return exportFinanceOrder(this.queryParams)
+        const params = { ...this.queryParams }
+        delete params.pageNum
+        delete params.pageSize
+        if (params.totalPrice === 0) params.totalPrice = null
+        if (params.collectionPrice === 0) params.collectionPrice = null
+        if (params.returnStatus === '' || params.returnStatus === null || params.returnStatus === undefined) delete params.returnStatus
+        return exportFinanceOrder(params)
       }).then(response => {
         this.download(response.msg)
         this.exportLoading = false

+ 11 - 7
src/views/store/rejectNoReturn/index.vue

@@ -110,6 +110,7 @@ export default {
       exportLoading: false,
       total: 0,
       tableList: [],
+      summaryData: {},
       deliveryTime: null,
       followTime: null,
       queryParams: {
@@ -149,6 +150,7 @@ export default {
       api(params).then(response => {
         this.tableList = response.rows || []
         this.total = response.total || 0
+        this.summaryData = response.summary || {}
         this.loading = false
       }).catch(() => {
         this.loading = false
@@ -228,8 +230,8 @@ export default {
         this.columnFilters[key] = []
       })
     },
-    /** 合计行:对金额列求和(基于当前页数据) */
-    getSummaries({ columns, data }) {
+    /** 合计行:使用后端返回的整个数据集汇总(非当前页) */
+    getSummaries({ columns }) {
       const sums = []
       const sumProps = ['totalPrice']
       columns.forEach((column, index) => {
@@ -238,11 +240,13 @@ export default {
           return
         }
         if (sumProps.includes(column.property)) {
-          const total = data.reduce((sum, row) => {
-            const v = Number(row[column.property])
-            return isNaN(v) ? sum : sum + v
-          }, 0)
-          sums[index] = total.toFixed(2)
+          const v = this.summaryData ? this.summaryData[column.property] : null
+          if (v === null || v === undefined || v === '') {
+            sums[index] = ''
+          } else {
+            const num = Number(v)
+            sums[index] = isNaN(num) ? '' : num.toFixed(2)
+          }
         } else {
           sums[index] = ''
         }

+ 14 - 7
src/views/store/rejectReport/index.vue

@@ -202,6 +202,7 @@ export default {
       orderExportLoading: false,
       orderTotal: 0,
       orderList: [],
+      orderSummaryData: {},
       orderDeliveryTime: null,
       orderCreateTime: null,
       orderRejectReturnTime: null,
@@ -233,6 +234,7 @@ export default {
       productExportLoading: false,
       productTotal: 0,
       productList: [],
+      productSummaryData: {},
       productQuery: {
         pageNum: 1,
         pageSize: 10,
@@ -327,23 +329,26 @@ export default {
         this.columnFilters[key] = []
       })
     },
-    /** 合计行:对金额/数量列求和(基于当前页数据) */
-    getSummaries({ columns, data }) {
+    /** 合计行:使用后端返回的整个数据集汇总(非当前页) */
+    getSummaries({ columns }) {
       const sums = []
       const sumProps = this.activeTab === 'order'
         ? ['totalPrice']
         : ['num', 'totalPrice']
+      const summaryData = this.activeTab === 'order' ? this.orderSummaryData : this.productSummaryData
       columns.forEach((column, index) => {
         if (index === 0) {
           sums[index] = '总计'
           return
         }
         if (sumProps.includes(column.property)) {
-          const total = data.reduce((sum, row) => {
-            const v = Number(row[column.property])
-            return isNaN(v) ? sum : sum + v
-          }, 0)
-          sums[index] = column.property === 'num' ? total : total.toFixed(2)
+          const v = summaryData ? summaryData[column.property] : null
+          if (v === null || v === undefined || v === '') {
+            sums[index] = ''
+          } else {
+            const num = Number(v)
+            sums[index] = isNaN(num) ? '' : (column.property === 'num' ? num : num.toFixed(2))
+          }
         } else {
           sums[index] = ''
         }
@@ -359,6 +364,7 @@ export default {
       api(params).then(response => {
         this.orderList = response.rows || []
         this.orderTotal = response.total || 0
+        this.orderSummaryData = response.summary || {}
         this.orderLoading = false
       }).catch(() => {
         this.orderLoading = false
@@ -438,6 +444,7 @@ export default {
       api(params).then(response => {
         this.productList = response.rows || []
         this.productTotal = response.total || 0
+        this.productSummaryData = response.summary || {}
         this.productLoading = false
       }).catch(() => {
         this.productLoading = false

+ 14 - 8
src/views/store/returnReport/index.vue

@@ -222,6 +222,7 @@ export default {
       orderExportLoading: false,
       orderTotal: 0,
       orderList: [],
+      orderSummaryData: {},
       orderDeliveryTime: null,
       orderCreateTime: null,
       orderReturnTime: null,
@@ -254,7 +255,7 @@ export default {
       productExportLoading: false,
       productTotal: 0,
       productList: [],
-      productReturnTime: null,
+      productSummaryData: {},
       productQuery: {
         pageNum: 1,
         pageSize: 10,
@@ -359,23 +360,26 @@ export default {
         this.handleProductQuery()
       }
     },
-    /** 合计行:对金额/数量列求和(基于当前页数据) */
-    getSummaries({ columns, data }) {
+    /** 合计行:使用后端返回的整个数据集汇总(非当前页) */
+    getSummaries({ columns }) {
       const sums = []
       const sumProps = this.activeTab === 'order'
         ? ['payPrice', 'totalPrice']
         : ['num', 'totalPrice']
+      const summaryData = this.activeTab === 'order' ? this.orderSummaryData : this.productSummaryData
       columns.forEach((column, index) => {
         if (index === 0) {
           sums[index] = '总计'
           return
         }
         if (sumProps.includes(column.property)) {
-          const total = data.reduce((sum, row) => {
-            const v = Number(row[column.property])
-            return isNaN(v) ? sum : sum + v
-          }, 0)
-          sums[index] = column.property === 'num' ? total : total.toFixed(2)
+          const v = summaryData ? summaryData[column.property] : null
+          if (v === null || v === undefined || v === '') {
+            sums[index] = ''
+          } else {
+            const num = Number(v)
+            sums[index] = isNaN(num) ? '' : (column.property === 'num' ? num : num.toFixed(2))
+          }
         } else {
           sums[index] = ''
         }
@@ -392,6 +396,7 @@ export default {
       api(params).then(response => {
         this.orderList = response.rows || []
         this.orderTotal = response.total || 0
+        this.orderSummaryData = response.summary || {}
         this.orderLoading = false
       }).catch(() => {
         this.orderLoading = false
@@ -467,6 +472,7 @@ export default {
       api(this.productQuery).then(response => {
         this.productList = response.rows || []
         this.productTotal = response.total || 0
+        this.productSummaryData = response.summary || {}
         this.productLoading = false
       }).catch(() => {
         this.productLoading = false

+ 2 - 6
src/views/store/signDetailReport/index.vue

@@ -11,8 +11,6 @@
         <el-select v-model="queryParams.orderType" placeholder="请选择订单类型" clearable size="small" style="width: 160px">
           <el-option label="外部订单" :value="1" />
           <el-option label="套餐包" :value="2" />
-          <el-option label="问诊" :value="3" />
-          <el-option label="积分" :value="4" />
         </el-select>
       </el-form-item>
       <el-form-item label="部门" prop="deptId">
@@ -138,9 +136,7 @@ export default {
     orderTypeFilters() {
       return [
         { text: '外部订单', value: 1 },
-        { text: '套餐包', value: 2 },
-        { text: '问诊', value: 3 },
-        { text: '积分', value: 4 }
+        { text: '套餐包', value: 2 }
       ]
     }
   },
@@ -255,7 +251,7 @@ export default {
       })
     },
     formatOrderType(type) {
-      const map = { 1: '外部订单', 2: '套餐包', 3: '问诊', 4: '积分' }
+      const map = { 1: '外部订单', 2: '套餐包'}
       return map[type] || '-'
     },
     getSummaries(param) {

+ 11 - 7
src/views/store/signReport/index.vue

@@ -127,6 +127,7 @@ export default {
       exportLoading: false,
       total: 0,
       tableList: [],
+      summaryData: {},
       deliveryTime: null,
       followTime: null,
       deptOptions: [],
@@ -178,6 +179,7 @@ export default {
       api(params).then(response => {
         this.tableList = response.rows || []
         this.total = response.total || 0
+        this.summaryData = response.summary || {}
         this.loading = false
       }).catch(() => {
         this.loading = false
@@ -233,8 +235,8 @@ export default {
         this.columnFilters[key] = [];
       });
     },
-    /** 合计行:对金额列求和(基于当前页数据) */
-    getSummaries({ columns, data }) {
+    /** 合计行:使用后端返回的整个数据集汇总(非当前页) */
+    getSummaries({ columns }) {
       const sums = [];
       const sumProps = ['payPrice', 'collectionPrice', 'totalPrice'];
       columns.forEach((column, index) => {
@@ -243,11 +245,13 @@ export default {
           return;
         }
         if (sumProps.includes(column.property)) {
-          const total = data.reduce((sum, row) => {
-            const v = Number(row[column.property]);
-            return isNaN(v) ? sum : sum + v;
-          }, 0);
-          sums[index] = total.toFixed(2);
+          const v = this.summaryData ? this.summaryData[column.property] : null;
+          if (v === null || v === undefined || v === '') {
+            sums[index] = '';
+          } else {
+            const num = Number(v);
+            sums[index] = isNaN(num) ? '' : num.toFixed(2);
+          }
         } else {
           sums[index] = '';
         }