lxf 2 éve
szülő
commit
91cb2f01f4

+ 34 - 34
src/components/process/Contract.vue

@@ -114,7 +114,7 @@
       <template #commodity>
         <div style="width: 100%">
           <el-button @click="openProduct = true">添加商品</el-button>
-          <el-table :data="formData.data.quotationProductList" style="width: 100%; margin-top: 16px">
+          <el-table :data="formData.data.contractProductList" style="width: 100%; margin-top: 16px">
             <el-table-column label="商品图片" width="80">
               <template #default="{ row }">
                 <div v-if="row.productId">
@@ -127,7 +127,7 @@
             <el-table-column label="商品名称">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
-                  <el-form-item :prop="'quotationProductList.' + $index + '.productName'" :rules="rules.productName" :inline-message="true">
+                  <el-form-item :prop="'contractProductList.' + $index + '.productName'" :rules="rules.productName" :inline-message="true">
                     <el-input v-model="row.productName" placeholder="请输入商品名称" />
                   </el-form-item>
                 </div>
@@ -136,7 +136,7 @@
             <el-table-column label="规格型号" width="180">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
-                  <el-form-item :prop="'quotationProductList.' + $index + '.productModel'" :rules="rules.productModel" :inline-message="true">
+                  <el-form-item :prop="'contractProductList.' + $index + '.productModel'" :rules="rules.productModel" :inline-message="true">
                     <el-input v-model="row.productModel" placeholder="请输入规格型号" />
                   </el-form-item>
                 </div>
@@ -146,7 +146,7 @@
             <el-table-column label="数量" width="160">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
-                  <el-form-item :prop="'quotationProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
+                  <el-form-item :prop="'contractProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
                     <el-input-number
                       v-model="row.quantity"
                       placeholder="请输入数量"
@@ -162,7 +162,7 @@
             <el-table-column label="单价" width="160">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
-                  <el-form-item :prop="'quotationProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true">
+                  <el-form-item :prop="'contractProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true">
                     <el-input-number
                       v-model="row.price"
                       placeholder="请输入单价"
@@ -188,11 +188,11 @@
       <template #otherCharge>
         <div style="width: 100%">
           <el-button type="primary" @click="clickAdd()">添加行</el-button>
-          <el-table :data="formData.data.quotationPayList" style="width: 100%; margin-top: 16px">
+          <el-table :data="formData.data.contractProjectList" style="width: 100%; margin-top: 16px">
             <el-table-column label="收费项目" width="220">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
-                  <el-form-item :prop="'quotationPayList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true">
+                  <el-form-item :prop="'contractProjectList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true">
                     <el-autocomplete v-model="row.payName" :fetch-suggestions="querySearch" clearable class="inline-input w-50" placeholder="请输入收费项目" />
                   </el-form-item>
                 </div>
@@ -201,7 +201,7 @@
             <el-table-column label="金额" width="180">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
-                  <el-form-item :prop="'quotationPayList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true">
+                  <el-form-item :prop="'contractProjectList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true">
                     <el-input-number
                       v-model="row.amount"
                       placeholder="请输入金额"
@@ -217,7 +217,7 @@
             <el-table-column label="备注">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
-                  <el-form-item :prop="'quotationPayList.' + $index + '.remark'">
+                  <el-form-item :prop="'contractProjectList.' + $index + '.remark'">
                     <el-input v-model="row.remark" placeholder="请输入备注" />
                   </el-form-item>
                 </div>
@@ -422,8 +422,8 @@ const openProduct = ref(false);
 const formData = reactive({
   data: {
     amount: undefined,
-    quotationProductList: [],
-    quotationPayList: [],
+    contractProductList: [],
+    contractProjectList: [],
     contractShipmentList: [],
   },
 });
@@ -780,7 +780,7 @@ const handlePerson = (item) => {
 };
 const pushGoods = (goods) => {
   if (goods && goods.length > 0) {
-    formData.data.quotationProductList = formData.data.quotationProductList.concat(
+    formData.data.contractProductList = formData.data.contractProductList.concat(
       goods.map((item) => {
         let fileUrl = "";
         if (item.fileList && item.fileList.length > 0) {
@@ -901,9 +901,9 @@ const onPreviewFile = (file) => {
 };
 const submitHandoverForm = () => {
   if (fileList.value && fileList.value.length > 0) {
-    formData.data.quotationProductList[productIndex.value].remark = productRow.data.remark;
+    formData.data.contractProductList[productIndex.value].remark = productRow.data.remark;
     if (fileList.value && fileList.value.length > 0) {
-      formData.data.quotationProductList[productIndex.value].fileList = fileList.value.map((item) => {
+      formData.data.contractProductList[productIndex.value].fileList = fileList.value.map((item) => {
         return {
           id: item.raw.id,
           fileName: item.raw.fileName,
@@ -911,23 +911,23 @@ const submitHandoverForm = () => {
         };
       });
     } else {
-      formData.data.quotationProductList[productIndex.value].fileList = [];
+      formData.data.contractProductList[productIndex.value].fileList = [];
     }
     openHandover.value = false;
   }
 };
 const handleRemove = (index) => {
-  formData.data.quotationProductList.splice(index, 1);
+  formData.data.contractProductList.splice(index, 1);
 };
 const calculationAmount = () => {
   nextTick(() => {
-    if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
-      for (let i = 0; i < formData.data.quotationProductList.length; i++) {
+    if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
+      for (let i = 0; i < formData.data.contractProductList.length; i++) {
         let money = 0;
-        if (formData.data.quotationProductList[i].quantity && formData.data.quotationProductList[i].price) {
-          money = parseFloat(Number(formData.data.quotationProductList[i].quantity) * Number(formData.data.quotationProductList[i].price)).toFixed(2);
+        if (formData.data.contractProductList[i].quantity && formData.data.contractProductList[i].price) {
+          money = parseFloat(Number(formData.data.contractProductList[i].quantity) * Number(formData.data.contractProductList[i].price)).toFixed(2);
         }
-        formData.data.quotationProductList[i].amount = money;
+        formData.data.contractProductList[i].amount = money;
       }
     }
     nextTick(() => {
@@ -937,31 +937,31 @@ const calculationAmount = () => {
 };
 const totalAmount = () => {
   let money = 0;
-  if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
-    for (let i = 0; i < formData.data.quotationProductList.length; i++) {
-      if (formData.data.quotationProductList[i].amount) {
-        money = parseFloat(Number(money) + Number(formData.data.quotationProductList[i].amount)).toFixed(2);
+  if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
+    for (let i = 0; i < formData.data.contractProductList.length; i++) {
+      if (formData.data.contractProductList[i].amount) {
+        money = parseFloat(Number(money) + Number(formData.data.contractProductList[i].amount)).toFixed(2);
       }
     }
   }
-  if (formData.data.quotationPayList && formData.data.quotationPayList.length > 0) {
-    for (let i = 0; i < formData.data.quotationPayList.length; i++) {
-      if (formData.data.quotationPayList[i].amount) {
-        money = parseFloat(Number(money) + Number(formData.data.quotationPayList[i].amount)).toFixed(2);
+  if (formData.data.contractProjectList && formData.data.contractProjectList.length > 0) {
+    for (let i = 0; i < formData.data.contractProjectList.length; i++) {
+      if (formData.data.contractProjectList[i].amount) {
+        money = parseFloat(Number(money) + Number(formData.data.contractProjectList[i].amount)).toFixed(2);
       }
     }
   }
   formData.data.amount = money;
 };
 const clickAdd = () => {
-  if (formData.data.quotationPayList && formData.data.quotationPayList.length > 0) {
-    formData.data.quotationPayList.push({ payName: "", amount: undefined, remark: "" });
+  if (formData.data.contractProjectList && formData.data.contractProjectList.length > 0) {
+    formData.data.contractProjectList.push({ payName: "", amount: undefined, remark: "" });
   } else {
-    formData.data.quotationPayList = [{ payName: "", amount: undefined, remark: "" }];
+    formData.data.contractProjectList = [{ payName: "", amount: undefined, remark: "" }];
   }
 };
 const handleDelete = (index) => {
-  formData.data.quotationPayList.splice(index, 1);
+  formData.data.contractProjectList.splice(index, 1);
 };
 const querySearch = (queryString, callback) => {
   proxy.post("/quotationPay/page", { payName: queryString }).then((res) => {
@@ -993,7 +993,7 @@ const clickDelete = (index) => {
 const handleSubmit = async () => {
   let status = await submit.value.handleSubmit(() => {});
   if (status) {
-    if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
+    if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
       return true;
     } else {
       ElMessage("请添加至少一件商品");

+ 116 - 42
src/views/salesMange/saleContract/contract/index.vue

@@ -21,6 +21,12 @@
             <span>{{ moneyFormat(item.amount, 2) }}</span>
           </div>
         </template>
+        <template #aaaaa="{ item }">
+          <div>
+            <!-- <span style="padding-right: 4px">{{ item.currency }}</span>
+            <span>{{ moneyFormat(item.amount, 2) }}</span> -->
+          </div>
+        </template>
         <template #advanceRatio="{ item }">
           <div>
             <span>{{ item.advanceRatio }}%</span>
@@ -35,9 +41,10 @@
 import { computed, ref } from "vue";
 import byTable from "@/components/byTable/index";
 import useUserStore from "@/store/modules/user";
+import { ElMessageBox } from "element-plus";
 
 const { proxy } = getCurrentInstance();
-const accountList = ref([]);
+const contractType = ref([]);
 const corporationList = ref([]);
 const status = ref([
   {
@@ -61,6 +68,20 @@ const status = ref([
     value: 99,
   },
 ]);
+const refundStatus = ref([
+  {
+    label: "未到款",
+    value: 0,
+  },
+  {
+    label: "部分到款",
+    value: 10,
+  },
+  {
+    label: "已到款",
+    value: 20,
+  },
+]);
 const sourceList = ref({
   data: [],
   pagination: {
@@ -81,23 +102,21 @@ const selectConfig = computed(() => {
       data: status.value,
     },
     {
-      label: "归属公司",
-      prop: "sellCorporationId",
-      data: corporationList.value,
+      label: "到款状态",
+      prop: "refundStatus",
+      data: refundStatus.value,
     },
+    // {
+    //   label: "归属公司",
+    //   prop: "sellCorporationId",
+    //   data: corporationList.value,
+    // },
   ];
 });
 const config = computed(() => {
   return [
     {
       attrs: {
-        label: "报价单号",
-        prop: "code",
-        width: 200,
-      },
-    },
-    {
-      attrs: {
         label: "归属公司",
         prop: "sellCorporationId",
       },
@@ -114,36 +133,76 @@ const config = computed(() => {
     },
     {
       attrs: {
-        label: "报价人",
-        prop: "userName",
-        width: 120,
+        label: "合同类型",
+        prop: "contractType",
+      },
+      render(type) {
+        let text = "";
+        if (contractType.value && contractType.value.length > 0) {
+          let data = contractType.value.filter((item) => item.value == type);
+          if (data && data.length > 0) {
+            text = data[0].label;
+          }
+        }
+        return text;
       },
     },
     {
       attrs: {
-        label: "报价时间",
-        prop: "createTime",
-        width: 160,
+        label: "合同编码",
+        prop: "code",
+        width: 180,
       },
     },
     {
       attrs: {
-        label: "客户名称",
+        label: "客户",
         prop: "buyCorporationId",
       },
+      render(type) {
+        let text = "";
+        if (customerList.value && customerList.value.length > 0) {
+          let data = customerList.value.filter((item) => item.value == type);
+          if (data && data.length > 0) {
+            text = data[0].label;
+          }
+        }
+        return text;
+      },
     },
     {
       attrs: {
-        label: "报价金额",
+        label: "版本号",
+        prop: "version",
+        width: 120,
+      },
+    },
+    {
+      attrs: {
+        label: "合同金额",
         slot: "amount",
         width: 140,
       },
     },
     {
       attrs: {
-        label: "预付比例",
-        slot: "advanceRatio",
-        width: 120,
+        label: "已到账金额",
+        slot: "aaaaa",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "业务员",
+        prop: "userName",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "创建时间",
+        prop: "createTime",
+        width: 160,
       },
     },
     {
@@ -173,24 +232,30 @@ const config = computed(() => {
         return [
           {
             attrs: {
-              label: "复制",
+              label: "作废",
               type: "primary",
               text: true,
             },
             el: "button",
             click() {
-              clickPrint(row);
-            },
-          },
-          {
-            attrs: {
-              label: "查看",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              clickPrint(row);
+              ElMessageBox.confirm("此操作将永久删除该数据, 是否继续?", "提示", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning",
+              }).then(() => {
+                proxy
+                  .post("/contract/edit", {
+                    id: row.id,
+                    status: 88,
+                  })
+                  .then(() => {
+                    ElMessage({
+                      message: "删除成功",
+                      type: "success",
+                    });
+                    getList();
+                  });
+              });
             },
           },
         ];
@@ -199,14 +264,23 @@ const config = computed(() => {
   ];
 });
 const getDict = () => {
-  proxy.post("/saleQuotation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
-    accountList.value = res.rows.map((item) => {
-      return {
-        label: item.alias,
-        value: item.id,
-      };
+  proxy
+    .post("/dictTenantData/page", {
+      pageNum: 1,
+      pageSize: 999,
+      dictCode: "contract_type",
+      tenantId: useUserStore().user.tenantId,
+    })
+    .then((res) => {
+      if (res.rows && res.rows.length > 0) {
+        contractType.value = res.rows.map((item) => {
+          return {
+            label: item.dictValue,
+            value: item.dictKey,
+          };
+        });
+      }
     });
-  });
   proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
     corporationList.value = res.rows.map((item) => {
       return {