浏览代码

feat: 对账单

liujt 2 周之前
父节点
当前提交
dcf5839403

+ 17 - 15
src/views/saleManage/saleOrder/accountstatement/components/accountDetailTable.vue

@@ -199,7 +199,7 @@
           },
           {
             minWidth: 140,
-            prop: 'saleOrderNo',
+            prop: 'orderNo',
             label: '销售订单编码',
             align: 'center',
             showOverflowTooltip: true
@@ -326,17 +326,19 @@
     },
     watch: {
       datasource: {
-        handler() {
+        handler(newVal, oldVal) {
           this.$nextTick(() => {
-            this.initDefaultValues();
-            this.buildFlatList();
+            // this.initDefaultValues();
+            // this.buildFlatList();
+            this.flatList = newVal;
+            console.log(this.flatList)
             this.calcTotals();
           });
         },
         immediate: true
       },
       queryDimension() {
-        this.buildFlatList();
+        // this.buildFlatList();
         this.calcTotals();
       }
     },
@@ -419,16 +421,16 @@
       },
       buildFlatList() {
         const list = [];
-        this.datasource.forEach((order) => {
-          const orderNo = order.orderNo || '';
-          (order.deliveryProducts || []).forEach((item) => {
-            list.push(this.buildRow(item, orderNo, false));
-          });
-          (order.returnProducts || []).forEach((item) => {
-            list.push(this.buildRow(item, orderNo, true));
-          });
-        });
-        this.flatList = list;
+        // this.datasource.forEach((order) => {
+        //   const orderNo = order.orderNo || '';
+        //   (order.deliveryProducts || []).forEach((item) => {
+        //     list.push(this.buildRow(item, orderNo, false));
+        //   });
+        //   (order.returnProducts || []).forEach((item) => {
+        //     list.push(this.buildRow(item, orderNo, true));
+        //   });
+        // });
+        // this.flatList = list;
       },
       calcTotals() {
         const amount =

+ 58 - 44
src/views/saleManage/saleOrder/accountstatement/components/addAccountDialog.vue

@@ -199,7 +199,7 @@
       addAdvanceReceipt() {
         this.$refs.advanceReceiptSelectRef.open();
       },
-      // 预收款选择器回调:将选中的预收款映射为应收信息行(字段对齐接口 advanceInfoDetailList)
+      // 预收款选择器回调:将选中的预收款映射为应收信息行(字段对齐接口 statReceiptDetailList
       onAdvanceReceiptSelected(row) {
         this.receivableList.push({
           advanceId: row.id,
@@ -281,7 +281,7 @@
         // });
         this.datasource = data.productList || [];
         this.receivableList =
-          (data.advanceInfo && data.advanceInfo.advanceInfoDetailList) || [];
+          (data.statReceipt && data.statReceipt.statReceiptDetailList) || [];
         this.dataForm = {
           ...this.dataForm,
           ...data,
@@ -342,50 +342,64 @@
           let data = await getStatementRecordSummaryAPI(searchQuery);
           console.log(data, 'data');
           this.loading = false;
-          data = data.map((item) => {
-            item.deliveryProducts = item.deliveryProducts.map((i) => {
-              return {
-                ...i,
-                taxRate: i.taxRate || 0,
-                discountRatio: i.discountRatio || 100,
-                singlePrice: i.singlePrice || 0,
-                originalTotalCount: i.totalCount // 保存原始数量值用于校验
-              };
-            });
-            return item;
-          });
-          this.datasource = data || [];
 
-          console.log(this.datasource, 'this.datasource~~~');
+          this.datasource = data.productList || [];
+        this.receivableList =
+          (data.statReceipt && data.statReceipt.statReceiptDetailList) || [];
+        this.dataForm = {
+          ...this.dataForm,
+          ...data,
+          fundType: data.fundType || 2,
+          transactionMethod: data.transactionMethod || 1,
+          collectionTerms: data.collectionTerms || '',
+          receiptStatus: data.receiptStatus || 0,
+          totalAdvanceConfirmAmount: data.totalAdvanceConfirmAmount || 0,
+          totalReceivableAmount: data.totalReceivableAmount || 0
+        }
+          // data = data.map((item) => {
+          //   item.deliveryProducts = item.deliveryProducts.map((i) => {
+          //     return {
+          //       ...i,
+          //       taxRate: i.taxRate || 0,
+          //       discountRatio: i.discountRatio || 100,
+          //       singlePrice: i.singlePrice || 0,
+          //       originalTotalCount: i.totalCount // 保存原始数量值用于校验
+          //     };
+          //   });
+          //   return item;
+          // });
+          // this.datasource = data || [];
+
+          // console.log(this.datasource, 'this.datasource~~~');
           // this.recorpayList = data.recorpayList || [];
-          this.dataForm = {
-            ...this.dataForm,
-            // amountPayablePrice: data.amountPayablePrice,
-            // amountReceivablePrice: data.amountReceivablePrice,
-            // amountTotalPrice: data.amountTotalPrice,
-            // amountPayablePass: data.amountPayablePass,
-            // amountReceivablePass: data.amountReceivablePass
-            orderTotalAmount:
-              data.reduce(
-                (pre, cur) => pre + Math.round(+cur.orderAmount * 100),
-                0
-              ) / 100,
-            amountTotalPrice:
-              data.reduce(
-                (pre, cur) => pre + Math.round(+cur.statementAmount * 100),
-                0
-              ) / 100,
-            amountCompletePrice:
-              data.reduce(
-                (pre, cur) => pre + Math.round(+cur.statementedAmount * 100),
-                0
-              ) / 100,
-            amountUnCompletePrice:
-              data.reduce(
-                (pre, cur) => pre + Math.round(+cur.unStatementAmount * 100),
-                0
-              ) / 100
-          };
+          // this.dataForm = {
+          //   ...this.dataForm,
+          //   // amountPayablePrice: data.amountPayablePrice,
+          //   // amountReceivablePrice: data.amountReceivablePrice,
+          //   // amountTotalPrice: data.amountTotalPrice,
+          //   // amountPayablePass: data.amountPayablePass,
+          //   // amountReceivablePass: data.amountReceivablePass
+          //   orderTotalAmount:
+          //     data.reduce(
+          //       (pre, cur) => pre + Math.round(+cur.orderAmount * 100),
+          //       0
+          //     ) / 100,
+          //   amountTotalPrice:
+          //     data.reduce(
+          //       (pre, cur) => pre + Math.round(+cur.statementAmount * 100),
+          //       0
+          //     ) / 100,
+          //   amountCompletePrice:
+          //     data.reduce(
+          //       (pre, cur) => pre + Math.round(+cur.statementedAmount * 100),
+          //       0
+          //     ) / 100,
+          //   amountUnCompletePrice:
+          //     data.reduce(
+          //       (pre, cur) => pre + Math.round(+cur.unStatementAmount * 100),
+          //       0
+          //     ) / 100
+          // };
           this.$forceUpdate();
         } catch (error) {
           this.loading = false;