lxf il y a 1 an
Parent
commit
f90212d180
1 fichiers modifiés avec 23 ajouts et 1 suppressions
  1. 23 1
      src/views/group/finance/check-bill/printOrder.vue

+ 23 - 1
src/views/group/finance/check-bill/printOrder.vue

@@ -28,11 +28,28 @@ const props = defineProps({
 });
 const loading = ref(false);
 const tableData = ref([]);
+const getAggregate = (data) => {
+  let total = 0;
+  if (data && data.length > 0) {
+    for (let i = 0; i < data.length; i++) {
+      if (data[i].skuSpecList && data[i].skuSpecList.length > 0) {
+        for (let j = 0; j < data[i].skuSpecList.length; j++) {
+          if (data[i].skuSpecList[j].total) {
+            total = Number(Math.round((total + data[i].skuSpecList[j].total) * 100) / 100);
+          }
+        }
+      }
+    }
+  }
+  return total;
+};
 onMounted(() => {
   if (props.rowData && props.rowData.id) {
     loading.value = true;
     proxy.post("/statementOfAccount/getDocumentByOrder", { id: props.rowData.id }).then(
       (res) => {
+        let total = getAggregate(proxy.deepClone(res));
+        console.log(getAggregate(proxy.deepClone(res)));
         let list = [];
         if (res && res.length > 0) {
           for (let i = 0; i < res.length; i++) {
@@ -72,6 +89,11 @@ onMounted(() => {
             }
           }
         }
+        list.push({
+          index: 1,
+          total: total,
+          wlnCreateTime: "总计:",
+        });
         tableData.value = Object.freeze(list);
         loading.value = false;
       },
@@ -217,7 +239,7 @@ const Row = ({ rowData, cells }) => {
       const cell = cells[mergeColumn[i]];
       const style = {
         ...cell.props.style,
-        backgroundColor: "var(--el-color-primary-light-3)",
+        backgroundColor: "#fff",
         height: `${rowData.index * 50 - 1}px`,
         alignSelf: "flex-start",
         zIndex: 1,