Browse Source

Merge branch '采购调整' into 测试

lxf 1 year ago
parent
commit
89d9299e6e
2 changed files with 77 additions and 19 deletions
  1. 48 4
      src/components/process/purchase.vue
  2. 29 15
      src/views/group/purchase/supplier/index.vue

+ 48 - 4
src/components/process/purchase.vue

@@ -191,6 +191,15 @@
           </el-form-item>
           </el-form-item>
         </div>
         </div>
       </template>
       </template>
+      <template #balancePayment>
+        <div style="width: 100%">{{ computeBalancePayment() }}</div>
+      </template>
+      <template #paymentDate>
+        <div style="width: 100%">
+          <span v-if="supplierData && supplierData.paymentType == 1">{{ formData.data.paymentDate }}</span>
+          <el-date-picker v-model="formData.data.paymentDate" type="date" placeholder="请选择" value-format="YYYY-MM-DD" v-else />
+        </div>
+      </template>
       <template #money>
       <template #money>
         <div style="width: 100%">
         <div style="width: 100%">
           <div style="padding: 8px; background-color: #e9f5fb; font-size: 12px; font-weight: 700">
           <div style="padding: 8px; background-color: #e9f5fb; font-size: 12px; font-weight: 700">
@@ -254,6 +263,10 @@ const formData = reactive({
     contract: "",
     contract: "",
     purchaseBomList: [],
     purchaseBomList: [],
     fileList: [],
     fileList: [],
+    receiveProvince: "福建省",
+    receiveCity: "福州市",
+    receiveDetailedAddress: "福清市三山镇横坑村金园路18号3号楼",
+    receivePostcode: "350000",
   },
   },
 });
 });
 const judgeStatus = () => {
 const judgeStatus = () => {
@@ -351,6 +364,18 @@ const formConfig = computed(() => {
       itemWidth: 33,
       itemWidth: 33,
     },
     },
     {
     {
+      type: "slot",
+      slotName: "balancePayment",
+      label: "尾款 (%)",
+      itemWidth: 34,
+    },
+    {
+      type: "slot",
+      prop: "paymentDate",
+      slotName: "paymentDate",
+      label: "付款日期",
+    },
+    {
       type: "title",
       type: "title",
       title: "款项金额",
       title: "款项金额",
       label: "",
       label: "",
@@ -401,6 +426,7 @@ const rules = ref({
   deliveryDate: [{ required: true, message: "请选择交付日期", trigger: "change" }],
   deliveryDate: [{ required: true, message: "请选择交付日期", trigger: "change" }],
   currency: [{ required: true, message: "请选择币种", trigger: "change" }],
   currency: [{ required: true, message: "请选择币种", trigger: "change" }],
   advancePayment: [{ required: true, message: "请输入预付款", trigger: "blur" }],
   advancePayment: [{ required: true, message: "请输入预付款", trigger: "blur" }],
+  paymentDate: [{ required: true, message: "请选择付款日期", trigger: "change" }],
 });
 });
 const getDemandData = () => {
 const getDemandData = () => {
   proxy.post("/supplier/page", { pageNum: 1, pageSize: 999 }).then((res) => {
   proxy.post("/supplier/page", { pageNum: 1, pageSize: 999 }).then((res) => {
@@ -427,17 +453,21 @@ const getDemandData = () => {
   });
   });
 };
 };
 getDemandData();
 getDemandData();
+const supplierData = ref({});
 const changeSupplier = () => {
 const changeSupplier = () => {
   if (formData.data.supplierId) {
   if (formData.data.supplierId) {
     let list = supplierList.value.filter((item) => item.id === formData.data.supplierId);
     let list = supplierList.value.filter((item) => item.id === formData.data.supplierId);
     if (list && list.length > 0) {
     if (list && list.length > 0) {
+      supplierData.value = list[0];
       formData.data.province = list[0].province;
       formData.data.province = list[0].province;
       formData.data.city = list[0].city;
       formData.data.city = list[0].city;
       formData.data.detailedAddress = list[0].detailedAddress;
       formData.data.detailedAddress = list[0].detailedAddress;
       formData.data.contactPerson = list[0].contactPerson1;
       formData.data.contactPerson = list[0].contactPerson1;
       formData.data.contactNumber = list[0].contactNumber1;
       formData.data.contactNumber = list[0].contactNumber1;
+      formData.data.paymentDate = "到货后次月1号起" + list[0].nextMonthDays + "天内,结算费用";
     }
     }
   } else {
   } else {
+    supplierData.value = {};
     formData.data.province = "";
     formData.data.province = "";
     formData.data.city = "";
     formData.data.city = "";
     formData.data.detailedAddress = "";
     formData.data.detailedAddress = "";
@@ -474,10 +504,17 @@ const clickDelete = (index) => {
   formData.data.purchaseBomList.splice(index, 1);
   formData.data.purchaseBomList.splice(index, 1);
 };
 };
 const changeReceiveGoodsType = () => {
 const changeReceiveGoodsType = () => {
-  formData.data.receiveProvince = "";
-  formData.data.receiveCity = "";
-  formData.data.receiveDetailedAddress = "";
-  formData.data.receivePostcode = "";
+  if (formData.data.receiveGoodsType == 1) {
+    formData.data.receiveProvince = "福建省";
+    formData.data.receiveCity = "福州市";
+    formData.data.receiveDetailedAddress = "福清市三山镇横坑村金园路18号3号楼";
+    formData.data.receivePostcode = "350000";
+  } else {
+    formData.data.receiveProvince = "";
+    formData.data.receiveCity = "";
+    formData.data.receiveDetailedAddress = "";
+    formData.data.receivePostcode = "";
+  }
   formData.data.receiveContactPerson = "";
   formData.data.receiveContactPerson = "";
   formData.data.receiveContactNumber = "";
   formData.data.receiveContactNumber = "";
 };
 };
@@ -660,6 +697,13 @@ onMounted(() => {
     });
     });
   }
   }
 });
 });
+const computeBalancePayment = () => {
+  let num = 100;
+  if (formData.data.advancePayment) {
+    num = Number(Math.round((num - formData.data.advancePayment) * 100) / 100);
+  }
+  return num + "%";
+};
 // 向父组件暴露
 // 向父组件暴露
 defineExpose({ getFormData, handleSubmit });
 defineExpose({ getFormData, handleSubmit });
 </script>
 </script>

+ 29 - 15
src/views/group/purchase/supplier/index.vue

@@ -27,6 +27,30 @@
 
 
     <el-dialog :title="modalType == 'add' ? '添加供应商' : '编辑供应商'" v-if="openDialog" v-model="openDialog" width="900">
     <el-dialog :title="modalType == 'add' ? '添加供应商' : '编辑供应商'" v-if="openDialog" v-model="openDialog" width="900">
       <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
       <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
+        <template #paymentType>
+          <div style="width: 100%; display: flex">
+            <el-form-item label="付款日期" prop="paymentType">
+              <el-radio-group v-model="formData.data.paymentType">
+                <el-radio :label="0">现结</el-radio>
+                <el-radio :label="1">月结</el-radio>
+              </el-radio-group>
+            </el-form-item>
+            <div style="padding-left: 10px">到货后次月1号起</div>
+            <el-form-item
+              label-width="0"
+              prop="nextMonthDays"
+              :rules="[{ required: formData.data.paymentType === 1 ? true : false, message: '请输入天数', trigger: 'blur' }]">
+              <el-input-number
+                onmousewheel="return false;"
+                v-model="formData.data.nextMonthDays"
+                placeholder="请输入"
+                :controls="false"
+                :min="0"
+                :precision="0" />
+            </el-form-item>
+            <div>天内,结算费用</div>
+          </div>
+        </template>
         <template #contactPerson1>
         <template #contactPerson1>
           <div style="width: 100%">
           <div style="width: 100%">
             <el-row :gutter="10">
             <el-row :gutter="10">
@@ -116,13 +140,6 @@ const config = computed(() => {
     },
     },
     {
     {
       attrs: {
       attrs: {
-        label: "账期",
-        prop: "paymentPeriod",
-        width: 120,
-      },
-    },
-    {
-      attrs: {
         label: "电话",
         label: "电话",
         prop: "companyTelephone",
         prop: "companyTelephone",
         width: 160,
         width: 160,
@@ -245,14 +262,6 @@ const formConfig = computed(() => {
       prop: "companyTelephone",
       prop: "companyTelephone",
       label: "公司电话",
       label: "公司电话",
       itemType: "text",
       itemType: "text",
-      itemWidth: 50,
-    },
-    {
-      type: "input",
-      prop: "paymentPeriod",
-      label: "账期",
-      itemType: "text",
-      itemWidth: 50,
     },
     },
     {
     {
       type: "input",
       type: "input",
@@ -281,6 +290,10 @@ const formConfig = computed(() => {
       itemType: "text",
       itemType: "text",
     },
     },
     {
     {
+      type: "slot",
+      slotName: "paymentType",
+    },
+    {
       type: "title",
       type: "title",
       title: "联系人信息",
       title: "联系人信息",
       label: "",
       label: "",
@@ -330,6 +343,7 @@ const formConfig = computed(() => {
 });
 });
 const rules = ref({
 const rules = ref({
   name: [{ required: true, message: "请输入供应商名称", trigger: "blur" }],
   name: [{ required: true, message: "请输入供应商名称", trigger: "blur" }],
+  paymentType: [{ required: true, message: "请选择付款日期", trigger: "change" }],
 });
 });
 const clickModal = () => {
 const clickModal = () => {
   modalType.value = "add";
   modalType.value = "add";