소스 검색

对账单上传文件

lxf 1 년 전
부모
커밋
016bf200a1
2개의 변경된 파일166개의 추가작업 그리고 62개의 파일을 삭제
  1. 154 56
      src/views/group/finance/check-bill/index.vue
  2. 12 6
      src/views/group/order/management/index.vue

+ 154 - 56
src/views/group/finance/check-bill/index.vue

@@ -44,9 +44,29 @@
       <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data">
         <template #orderIdList>
           <div style="width: 100%">
-            <div style="margin-bottom: 10px">
-              <el-button type="primary" size="small" @click="clickAddContract()">选择合同</el-button>
-            </div>
+            <el-form-item label="事业部" prop="departmentId" style="margin-bottom: 18px">
+              <el-select v-model="formData.data.departmentId" placeholder="请选择事业部" clearable @change="changeDepartment">
+                <el-option v-for="item in departmentList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
+              </el-select>
+              <el-button type="primary" size="small" style="margin-left: 16px" @click="clickAddOrder()">选择合同</el-button>
+            </el-form-item>
+            <el-table :data="formData.data.orderList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
+              <el-table-column label="事业部" prop="departmentName" width="140" />
+              <el-table-column label="订单号" prop="code" min-width="180" />
+              <el-table-column label="万里牛单号" prop="wlnCode" width="150" />
+              <el-table-column label="订单总金额 ¥" prop="totalAmount" align="right" width="120" />
+              <el-table-column label="产品总金额 ¥" prop="productTotalAmount" align="right" width="120" />
+              <el-table-column label="定制加工费 ¥" prop="customProcessingFee" align="right" width="110" />
+              <el-table-column label="代发费 ¥" prop="lssueFee" align="right" width="100" />
+              <el-table-column label="快递包材费 ¥" prop="deliveryMaterialsFee" align="right" width="110" />
+              <el-table-column label="包装人工费 ¥" prop="packingLabor" align="right" width="110" />
+              <el-table-column label="包材费 ¥" prop="packagingMaterialCost" align="right" width="100" />
+              <el-table-column label="操作" align="center" fixed="right" width="60">
+                <template #default="{ $index }">
+                  <el-button type="primary" @click="clickOrderDelete($index)" text>删除</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
           </div>
         </template>
       </byForm>
@@ -58,7 +78,7 @@
 
     <el-dialog title="上传对账单" v-if="openReceiptFile" v-model="openReceiptFile" width="600">
       <el-upload
-        v-model:fileList="formReceiptData.data.fileList"
+        v-model:fileList="fileList"
         action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
         :data="uploadReceiptData"
         multiple
@@ -75,7 +95,7 @@
 
     <el-dialog title="上传转账凭证" v-if="openProofFile" v-model="openProofFile" width="600">
       <el-upload
-        v-model:fileList="formProofData.data.fileList"
+        v-model:fileList="fileList"
         action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
         :data="uploadProofData"
         multiple
@@ -89,13 +109,21 @@
         <el-button type="primary" @click="submitProofFile()" size="large" v-preReClick>确 定</el-button>
       </template>
     </el-dialog>
+
+    <el-dialog title="选择合同" v-if="openOrder" v-model="openOrder" width="90%">
+      <SelectOrder :selectStatus="true" :departmentId="formData.data.departmentId" @selectOrder="selectOrder"></SelectOrder>
+      <template #footer>
+        <el-button @click="openOrder = false" size="large">关 闭</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
-<script setup>
+<script setup name="Check-bill">
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
 import { ElMessage, ElMessageBox } from "element-plus";
+import SelectOrder from "@/views/group/order/management/index";
 
 const { proxy } = getCurrentInstance();
 const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
@@ -196,13 +224,13 @@ const config = computed(() => {
         return [
           {
             attrs: {
-              label: "下载",
+              label: "打印",
               type: "primary",
               text: true,
             },
             el: "button",
             click() {
-              clickUpdate(row);
+              clickPrint(row);
             },
           },
           {
@@ -301,20 +329,72 @@ const clickModal = () => {
     departmentId: "",
     amount: "",
     orderIdList: [],
+    orderList: [],
   };
   openDialog.value = true;
 };
+const changeDepartment = () => {
+  formData.data.orderList = [];
+};
+const openOrder = ref(false);
+const clickAddOrder = () => {
+  if (formData.data.departmentId) {
+    openOrder.value = true;
+  } else {
+    return ElMessage("请先选择事业部");
+  }
+};
+const selectOrder = (row) => {
+  if (formData.data.orderList && formData.data.orderList.length > 0) {
+    let list = formData.data.orderList.filter((item) => item.id === row.id);
+    if (list && list.length > 0) {
+      return ElMessage("该订单已添加");
+    }
+  } else {
+    formData.data.orderList = [];
+  }
+  formData.data.orderList.push({
+    id: row.id,
+    departmentName: row.departmentName,
+    code: row.code,
+    wlnCode: row.wlnCode,
+    totalAmount: row.totalAmount,
+    productTotalAmount: row.productTotalAmount,
+    customProcessingFee: row.customProcessingFee,
+    lssueFee: row.lssueFee,
+    deliveryMaterialsFee: row.deliveryMaterialsFee,
+    packingLabor: row.packingLabor,
+    packagingMaterialCost: row.packagingMaterialCost,
+  });
+  ElMessage({ message: "添加成功", type: "success" });
+};
+const clickOrderDelete = (index) => {
+  formData.data.orderList.splice(index, 1);
+};
 const submitForm = () => {
-  // submit.value.handleSubmit(() => {
-  //   proxy.post("/statementOfAccount/" + modalType.value, formData.data).then(() => {
-  //     ElMessage({
-  //       message: modalType.value == "add" ? "添加成功" : "编辑成功",
-  //       type: "success",
-  //     });
-  //     openDialog.value = false;
-  //     getList();
-  //   });
-  // });
+  if (formData.data.orderList && formData.data.orderList.length > 0) {
+    let amount = 0;
+    for (let i = 0; i < formData.data.orderList.length; i++) {
+      amount = Number(Math.round((amount + formData.data.orderList[i].totalAmount) * 100) / 100);
+    }
+    let orderIdList = formData.data.orderList.map((item) => item.id);
+    proxy
+      .post("/statementOfAccount/" + modalType.value, {
+        departmentId: formData.data.departmentId,
+        amount: amount,
+        orderIdList: orderIdList,
+      })
+      .then(() => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        openDialog.value = false;
+        getList();
+      });
+  } else {
+    return ElMessage("请先添加订单");
+  }
 };
 const clickUpdate = (row) => {
   modalType.value = "edit";
@@ -344,25 +424,24 @@ const formReceiptData = reactive({
     fileList: [],
   },
 });
+const fileList = ref([]);
 const clickReceiptFile = (row) => {
+  formReceiptData.data = {
+    id: row.id,
+    fileList: [],
+  };
   if (row.receiptFileList && row.receiptFileList.length > 0) {
-    formReceiptData.data = {
-      id: row.id,
-      fileList: proxy.deepClone(
-        row.receiptFileList.map((item) => {
-          return {
-            raw: item,
-            name: item.fileName,
-            url: item.fileUrl,
-          };
-        })
-      ),
-    };
+    fileList.value = proxy.deepClone(
+      row.receiptFileList.map((item) => {
+        return {
+          raw: item,
+          name: item.fileName,
+          url: item.fileUrl,
+        };
+      })
+    );
   } else {
-    formReceiptData.data = {
-      id: row.id,
-      fileList: [],
-    };
+    fileList.value = [];
   }
   openReceiptFile.value = true;
 };
@@ -383,12 +462,21 @@ const onPreviewFile = (file) => {
   window.open(file.raw.fileUrl, "_blank");
 };
 const submitReceiptFile = () => {
-  if (formReceiptData.data.fileList && formReceiptData.data.fileList.length > 0) {
-    for (let i = 0; i < formReceiptData.data.fileList.length; i++) {
-      if (formReceiptData.data.fileList[i].raw.uploadState) {
+  if (fileList.value && fileList.value.length > 0) {
+    for (let i = 0; i < fileList.value.length; i++) {
+      if (fileList.value[i].raw.uploadState) {
         return ElMessage("文件上传中,请稍后提交");
       }
     }
+    formReceiptData.data.fileList = fileList.value.map((item) => {
+      return {
+        id: item.raw.id,
+        fileName: item.raw.fileName,
+        fileUrl: item.raw.fileUrl,
+      };
+    });
+  } else {
+    formReceiptData.data.fileList = [];
   }
   proxy.post("/statementOfAccount/editReceiptFile", formReceiptData.data).then(() => {
     openReceiptFile.value = false;
@@ -403,24 +491,22 @@ const formProofData = reactive({
   },
 });
 const clickProofFile = (row) => {
+  formProofData.data = {
+    id: row.id,
+    fileList: [],
+  };
   if (row.proofFileList && row.proofFileList.length > 0) {
-    formProofData.data = {
-      id: row.id,
-      fileList: proxy.deepClone(
-        row.proofFileList.map((item) => {
-          return {
-            raw: item,
-            name: item.fileName,
-            url: item.fileUrl,
-          };
-        })
-      ),
-    };
+    fileList.value = proxy.deepClone(
+      row.proofFileList.map((item) => {
+        return {
+          raw: item,
+          name: item.fileName,
+          url: item.fileUrl,
+        };
+      })
+    );
   } else {
-    formProofData.data = {
-      id: row.id,
-      fileList: [],
-    };
+    fileList.value = [];
   }
   openProofFile.value = true;
 };
@@ -438,18 +524,30 @@ const handleProofSuccess = (any, UploadFile) => {
   UploadFile.raw.uploadState = false;
 };
 const submitProofFile = () => {
-  if (formProofData.data.fileList && formProofData.data.fileList.length > 0) {
-    for (let i = 0; i < formProofData.data.fileList.length; i++) {
-      if (formProofData.data.fileList[i].raw.uploadState) {
+  if (fileList.value && fileList.value.length > 0) {
+    for (let i = 0; i < fileList.value.length; i++) {
+      if (fileList.value[i].raw.uploadState) {
         return ElMessage("文件上传中,请稍后提交");
       }
     }
+    formProofData.data.fileList = fileList.value.map((item) => {
+      return {
+        id: item.raw.id,
+        fileName: item.raw.fileName,
+        fileUrl: item.raw.fileUrl,
+      };
+    });
+  } else {
+    formProofData.data.fileList = [];
   }
   proxy.post("/statementOfAccount/editProofFile", formProofData.data).then(() => {
     openProofFile.value = false;
     getList();
   });
 };
+const clickPrint = (row) => {
+  console.log(row);
+};
 </script>
 
 <style lang="scss" scoped>

+ 12 - 6
src/views/group/order/management/index.vue

@@ -75,6 +75,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
 const { proxy } = getCurrentInstance();
 const props = defineProps({
   selectStatus: Boolean,
+  departmentId: String,
 });
 const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
 const sourceList = ref({
@@ -103,12 +104,14 @@ const searchConfig = computed(() => {
       prop: "wlnCode",
       label: "万里牛单号",
     },
-    {
-      type: "select",
-      prop: "departmentId",
-      data: departmentList.value,
-      label: "事业部",
-    },
+    props.departmentId
+      ? {}
+      : {
+          type: "select",
+          prop: "departmentId",
+          data: departmentList.value,
+          label: "事业部",
+        },
     {
       type: "select",
       prop: "status",
@@ -371,6 +374,9 @@ const getList = async (req, status) => {
   if (props.selectStatus) {
     sourceList.value.pagination.linkedStatementOfAccount = 0;
   }
+  if (props.departmentId) {
+    sourceList.value.pagination.departmentId = props.departmentId;
+  }
   loading.value = true;
   proxy.post("/orderInfo/page", sourceList.value.pagination).then((res) => {
     sourceList.value.data = res.rows;