Browse Source

销售订单-数量允许修改

jingbb 2 months ago
parent
commit
e67a048549

+ 2 - 1
src/views/saleCode/salesOrder/SaleOrderForm.data.ts

@@ -287,7 +287,8 @@ export const saleOrderProductColumns: JVxeColumn[] = [
     {
       title: '数量(quantity)',
       key: 'quantity',
-      type: JVxeTypes.normal,
+      type: JVxeTypes.inputNumber,
+      validateRules: [{ required: true, message: '' }],
       placeholder: '请输入${title}',
       width:"200px",
       defaultValue:'',

+ 30 - 9
src/views/saleCode/salesOrder/components/SlaeOrderFormForm.vue

@@ -682,15 +682,21 @@
         if (formData.sourceCode == '' && formData.sourceCode2 == '') {
           message.warning('请选择合同或报价单');
         } else {
-          const mainData = await getFormData();
-          const subData = await getSubFormAndTableData();
-          const values = Object.assign({}, dbData, mainData, subData);
-          console.log('表单提交数据', values);
-          const isUpdate = values.id ? true : false;
-          const isRevise = values.submit == '1' ? true : false;
-          await saveOrUpdate(values, isUpdate, isRevise);
-          //关闭弹窗
-          emit('success');
+          SaleOrderFormShipFormProductTableRef.value!.validateTable().then(async (errMap) => {
+            if (errMap) {
+              console.log('表单验证未通过:', { errMap });
+            } else {
+              const mainData = await getFormData();
+              const subData = await getSubFormAndTableData();
+              const values = Object.assign({}, dbData, mainData, subData);
+              console.log('表单提交数据', values);
+              const isUpdate = values.id ? true : false;
+              const isRevise = values.submit == '1' ? true : false;
+              await saveOrUpdate(values, isUpdate, isRevise);
+              //关闭弹窗
+              emit('success');
+            }
+          });
         }
       }
 
@@ -880,6 +886,17 @@
           formData.convertedAmount = allAmount;
           formData.convertedAmount = Number(formData.convertedAmount).toFixed(2);
         }
+        if (prop.col.key == 'quantity' && prop.row.quantity && prop.row.discountedPrice&& prop.row.taxPrice) {
+          prop.row.taxAmount = (prop.value * prop.row.taxPrice).toFixed(2);
+          prop.row.discountedAmount = (prop.value * prop.row.discountedPrice).toFixed(2);
+          var arr = SaleOrderFormShipFormProductTableRef.value.getTableData();
+          var allAmount = 0;
+          arr.map((item) => {
+            allAmount = allAmount + Number(item.discountedAmount);
+          });
+          formData.convertedAmount = allAmount;
+          formData.convertedAmount = Number(formData.convertedAmount).toFixed(2);
+        }
       }
       /**
        * 值改变事件触发-树控件回调
@@ -954,4 +971,8 @@
   /deep/.ant-form-item {
     margin-bottom: 8px !important;
   }
+  /deep/.vxe-cell--valid-error-msg {
+    color: red !important;
+    background-color: white !important;
+  }
 </style>