فهرست منبع

产品销售统计数据汇总

lxb 5 روز پیش
والد
کامیت
bfc8961b35
1فایلهای تغییر یافته به همراه28 افزوده شده و 3 حذف شده
  1. 28 3
      src/views/hisStore/statistics/storeProduct.vue

+ 28 - 3
src/views/hisStore/statistics/storeProduct.vue

@@ -93,7 +93,26 @@
                 <span :class="{'group-name': scope.row.isGroup}">{{ scope.row.name }}</span>
               </template>
             </el-table-column>
+            <!-- 汇总数据-->
+            <el-table-column label="汇总" align="center">
+              <el-table-column
+                label="数量"
+                width="60"
+                align="center"> <template slot-scope="scope">
+                {{ scope.row.totalCount || 0 }}
+              </template>
+              </el-table-column>
+              <!-- 金额子列 -->
+              <el-table-column
+                label="金额"
+                width="80"
+                align="center">
+                <template slot-scope="scope">
+                  {{ scope.row.totalAmount ? scope.row.totalAmount.toFixed(2) : '0.00' }}
+                </template>
+              </el-table-column>
 
+            </el-table-column>
             <!-- 动态生成订单类型列 - 使用多级表头 -->
             <el-table-column
               v-for="orderType in orderTypeOptions"
@@ -212,6 +231,7 @@ export default {
     // 获取订单类型字典
     this.getDicts("store_order_type").then((response) => {
       this.orderTypeOptions = response.data;
+      console.log(response.data)
     });
   },
   methods: {
@@ -231,7 +251,6 @@ export default {
       var param = { companyId: this.companyId }
       treeselect(param).then((response) => {
         this.deptOptions = response.data;
-        console.log(this.deptOptions)
         if (response.data != null && response.data.length > 0) {
           this.deptId = response.data[0].id;
           that.storeProduct()
@@ -289,7 +308,8 @@ export default {
       return rawTableData.map(item => {
         // 创建一个新的 productCounts 对象,包含所有订单类型
         const processedProductCounts = {};
-
+        let totalCount = 0;
+        let totalAmount = 0.0;
         // 遍历所有订单类型选项,为每个类型设置默认值
         this.orderTypeOptions.forEach(orderType => {
           const dictValue = orderType.dictValue;
@@ -303,11 +323,16 @@ export default {
               amount: 0.0
             };
           }
+          // 累加汇总数据
+          totalCount += processedProductCounts[dictValue].count;
+          totalAmount += processedProductCounts[dictValue].amount;
         });
 
         return {
           ...item,
-          productCounts: processedProductCounts
+          productCounts: processedProductCounts,
+          totalCount: totalCount,
+          totalAmount: totalAmount
         };
       });
     },