Browse Source

build:订单对账

snow 1 year ago
parent
commit
42a9146ce6
28 changed files with 632 additions and 122 deletions
  1. 7 6
      .env.development
  2. 1 1
      .vscode/settings.json
  3. 1 1
      src/api/InvoiceSales/capitalPool/index.ts
  4. 18 0
      src/api/InvoiceSales/currentcyAssOrderRecord/index.ts
  5. 27 0
      src/api/InvoiceSales/currentcyOrderRecord/index.ts
  6. 6 0
      src/utils/http/index.ts
  7. 48 0
      src/views/InvoiceSales/currentcyAssOrderRecord/config/content.config.ts
  8. 53 0
      src/views/InvoiceSales/currentcyAssOrderRecord/config/search.config.ts
  9. 21 0
      src/views/InvoiceSales/currentcyAssOrderRecord/index.vue
  10. 0 0
      src/views/InvoiceSales/currentcyAssOrderRecord/通用订单关联订单已回款列表.md
  11. 6 0
      src/views/InvoiceSales/currentcyOrderRecord/config/_options.ts
  12. 78 0
      src/views/InvoiceSales/currentcyOrderRecord/config/content.config.ts
  13. 49 0
      src/views/InvoiceSales/currentcyOrderRecord/config/search.config.ts
  14. 55 0
      src/views/InvoiceSales/currentcyOrderRecord/detail.vue
  15. 44 0
      src/views/InvoiceSales/currentcyOrderRecord/index.vue
  16. 0 0
      src/views/InvoiceSales/currentcyOrderRecord/通用订单对账管理
  17. 2 2
      src/views/purchase/orderRecord/config/content.config.ts
  18. 1 1
      src/views/supply/orderRecord/index.vue
  19. 10 16
      src/views/supply/ticketReturn/components/execl-files-upload/columns-config.ts
  20. 68 67
      src/views/supply/ticketReturn/components/execl-files-upload/index.vue
  21. 5 8
      src/views/supply/ticketReturn/config/xls-template.ts
  22. 26 2
      src/views/supply/ticketReturn/index.vue
  23. 23 10
      src/views/supplyInvoiceSaleSettings/_component/execl-files-upload/columns-config.ts
  24. 2 1
      src/views/supplyInvoiceSaleSettings/_component/execl-files-upload/index.vue
  25. 14 4
      src/views/supplyInvoiceSaleSettings/_component/procure-import/columns-config.ts
  26. 12 0
      src/views/supplyInvoiceSaleSettings/_config/xls-template.ts
  27. 27 1
      src/views/supplyInvoiceSaleSettings/supplyCommodityCost/index.vue
  28. 28 2
      src/views/supplyInvoiceSaleSettings/supplyConsultingCost/index.vue

+ 7 - 6
.env.development

@@ -16,18 +16,16 @@ VITE_APP_ID = "ww6076e6fd4268ee31"
 # 微信开发环境基础重定向url
 REDIRECT_BASE_URL = "http://cxinv.api.caixiao365.com"
 # 开发环境后端用户地址
-VITE_PROXY_USER_REAL1 = "http://user.api.caixiao365.com"
+VITE_PROXY_USER_REAL1 = "http://user.test241.wanyuhengtong.com"
 # 开发环境后端用户地址
-VITE_PROXY_USER_REAL = "http://cxinv.api.caixiao365.com"
+VITE_PROXY_USER_REAL = "http://localhost:8000"
 # 开发环境后端业务地址
-VITE_PROXY_DOMAIN_REAL = "http://cxinv.api.caixiao365.com"
+VITE_PROXY_DOMAIN_REAL = "http://localhost:8000"
 
 VITE_IS_PROD = true
 
-# 跳转采销地址
+# 跳转结算地址
 VITE_PURCHASE_URL = 'http://pin.caixiao365.com/'
-# 跳转工单地址
-VITE_GD_URL='http://bug.caixiao365.com/'
 
 # 报表地址
 VITE_DASHBOARD_URL = 'http://web.report.caixiao365.com/'
@@ -35,3 +33,6 @@ VITE_DASHBOARD_URL = 'http://web.report.caixiao365.com/'
 # token密钥
 VITE_SECRET_KEY = 'key123'
 
+
+# 跳转工单地址
+VITE_GD_URL = 'http://bug.caixiao365.com/'

+ 1 - 1
.vscode/settings.json

@@ -24,7 +24,7 @@
     "editor.defaultFormatter": "esbenp.prettier-vscode"
   },
   "editor.codeActionsOnSave": {
-    "source.fixAll.eslint": true
+    "source.fixAll.eslint": "explicit"
   },
   "iconify.excludes": ["el"]
 }

+ 1 - 1
src/api/InvoiceSales/capitalPool/index.ts

@@ -11,7 +11,7 @@ interface ResponseType extends Promise<any> {
 
 // 列表
 export const httpList = (data: object): ResponseType => {
-  return http.request("post", `${yewuApi}tradeList`, { data });
+  return http.request("post", `${yewuApi}paylist`, { data });
 };
 // 详情
 export const httpDetail = (data: object): ResponseType => {

+ 18 - 0
src/api/InvoiceSales/currentcyAssOrderRecord/index.ts

@@ -0,0 +1,18 @@
+import { http } from "/@/utils/http"
+import { loadEnv } from "@build/index"
+
+const { VITE_PROXY_USER_REAL } = loadEnv();
+
+const baseUrl = `${VITE_PROXY_USER_REAL}/admin/`
+
+interface ResponseType extends Promise<any> {
+  message?: string
+  code?: number
+  data?: any
+}
+
+
+// 列表
+export const httpList = (data: any): ResponseType => {
+  return http.request('post', `${baseUrl}paylist`, { data })
+}

+ 27 - 0
src/api/InvoiceSales/currentcyOrderRecord/index.ts

@@ -0,0 +1,27 @@
+import { http } from "/@/utils/http"
+import { loadEnv } from "@build/index";
+
+const { VITE_PROXY_USER_REAL } = loadEnv();
+
+const baseUrl = `${VITE_PROXY_USER_REAL}/admin/`;
+
+interface ResponseType extends Promise<any> {
+  message?: string
+  code?: number
+  data?: any
+}
+
+//列表
+export const httpList = (data: any): ResponseType => {
+  return http.request('post', `${baseUrl}paylist`, { data })
+}
+
+//详情
+export const httpDetail = (data: any): ResponseType => {
+  return http.request('post', `${baseUrl}tradeloginfo`, { data })
+}
+
+//审核状态
+export const httpStatus = (data: any): ResponseType => {
+  return http.request('post', `${baseUrl}orderpaystatus`, { data })
+}

+ 6 - 0
src/utils/http/index.ts

@@ -86,6 +86,12 @@ class PureHttp {
             delete config.data["noRela"];
           }
 
+          if (config.data["emptyRela"] || isSuper) {
+            delete config.data["relaComNo"];
+            delete config.data["emptyRela"];
+          }
+
+
           return $config;
         } else {
           return $config;

+ 48 - 0
src/views/InvoiceSales/currentcyAssOrderRecord/config/content.config.ts

@@ -0,0 +1,48 @@
+import { ContentConfig } from "/@/components/PageContent";
+import { httpList } from "/@/api/InvoiceSales/capitalPool";
+
+// {
+//   label: '卖出方公司',
+//     prop: 'supplierName',
+//       minWidth: 175,
+//     ...renderIconLabelLeft('supplierNo', 'supplierName', '卖出方公司编码:')
+// },
+
+const columns = [
+  {
+    label: "确认单编号",
+    prop: "orderCode",
+    fixed: "left",
+    width: "150px"
+  },
+  {
+    label: '销售主单号',
+    prop: 'orderCode',
+    width: "150px"
+  },
+  {
+    label: '申请人',
+    prop: 'apply_name',
+    width: '100px'
+  },
+  {
+    label: '卖出方公司',
+
+  },
+  {
+    label: "操作",
+    fixed: "right",
+    width: 60, //后期修改
+    slot: "operation"
+  }
+];
+
+const contentConfig: ContentConfig = {
+  title: "通用订单关联订单已回款列表",
+  columns,
+  apis: {
+    httpList
+  }
+};
+
+export default contentConfig;

+ 53 - 0
src/views/InvoiceSales/currentcyAssOrderRecord/config/search.config.ts

@@ -0,0 +1,53 @@
+import { FormConfig } from "/@/components/PageSearch";
+import { CAPITAL_STATUS } from "/@/utils/details/tragelog";
+import { useTypeOptions } from "/@/utils/status";
+
+const searchFormConfig: FormConfig = {
+  formItems: [
+    {
+      field: "timer",
+      type: "date_picker",
+      otherOptions: {
+        type: "daterange",
+        startProp: "start",
+        endProp: "end",
+        startPlaceholder: "资金认领起始时间",
+        endPlaceholder: "资金认领结束时间"
+      }
+    },
+    {
+      field: "status",
+      type: "select",
+      placeholder: "资金认领状态",
+      options: CAPITAL_STATUS
+    },
+    {
+      field: "platform_type",
+      type: "select",
+      placeholder: "平台类型",
+      options: useTypeOptions
+    },
+    {
+      field: "logNo",
+      type: "input",
+      placeholder: "资金认领编码"
+    },
+    {
+      field: "tradNo",
+      type: "input",
+      placeholder: "资金编码"
+    },
+    {
+      field: "orderCode",
+      type: "input",
+      placeholder: "销售订单编码"
+    },
+    {
+      field: "cxCode",
+      type: "input",
+      placeholder: "销售主单号"
+    }
+  ]
+};
+
+export default searchFormConfig;

+ 21 - 0
src/views/InvoiceSales/currentcyAssOrderRecord/index.vue

@@ -0,0 +1,21 @@
+<script setup lang="ts">
+import contentConfig from "./config/content.config";
+import searchConfig from "./config/search.config";
+import { usePageSearch, type PageHooks, type PageEvent } from "/@/hooks/page";
+
+const pageName = "currentcyAssOrderRecord";
+
+const hooks: PageHooks = {
+  pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig)
+};
+</script>
+
+<template>
+  <PageAuth :pageName="pageName">
+    <PageContainer
+      :hooks="hooks"
+      :contentConfig="contentConfig"
+      :search-config="searchConfig"
+    />
+  </PageAuth>
+</template>

+ 0 - 0
src/views/InvoiceSales/currentcyAssOrderRecord/通用订单关联订单已回款列表.md


+ 6 - 0
src/views/InvoiceSales/currentcyOrderRecord/config/_options.ts

@@ -0,0 +1,6 @@
+export const statusOptions = [
+  { value: '1', label: '买方公司业务审核' },
+  { value: '2', label: '审核成功' },
+  { value: '3', label: '买方驳回' },
+  { value: '4', label: '已撤销对账' }
+];

+ 78 - 0
src/views/InvoiceSales/currentcyOrderRecord/config/content.config.ts

@@ -0,0 +1,78 @@
+import { h } from "vue";
+
+import { ElTag } from "element-plus";
+import { statusOptions } from "./_options"
+import { hasAccountOptions } from "/@/utils/status";
+import { ContentConfig } from "/@/components/PageContent";
+import { httpList } from "/@/api/InvoiceSales/currentcyOrderRecord";
+import { renderIconLabelLeft, renderProp } from "/@/utils/columnRenderHelper";
+
+const columns = [
+  {
+    label: "对账编号",
+    prop: "payNo",
+    fixed: "left",
+    minWidth: "150px"
+  },
+  {
+    label: '对账单总金额',
+    prop: 'dzTotalAmount',
+    width: '100px'
+  },
+  {
+    label: '状态',
+    prop: 'status',
+    width: '120px',
+    cellRenderer({ row }) {
+      return h(ElTag, null, {
+        default: () => {
+          return statusOptions.find(({ value }) => value === String(row.status))?.label || '--'
+        }
+      })
+    }
+  },
+  {
+    label: '供应商端',
+    prop: 'has_account',
+    width: 80,
+    ...renderProp(hasAccountOptions, "has_account")
+  },
+  {
+    label: '卖出方公司',
+    prop: 'supplierName',
+    minWidth: 175,
+    ...renderIconLabelLeft('supplierNo', 'supplierName', '卖出方公司编码:')
+  },
+  {
+    label: '买入方公司',
+    prop: 'companyName',
+    minWidth: 175,
+    ...renderIconLabelLeft('companyNo', 'companyName', '买入方公司编码:')
+  },
+  {
+    label: '创建人',
+    prop: 'apply_name',
+    minWidth: '100px'
+  },
+  {
+    label: '创建时间',
+    prop: 'addtime',
+    width: '145px'
+  },
+  {
+    label: "操作",
+    fixed: "right",
+    width: 60, //后期修改
+    slot: "operation"
+  }
+];
+
+const contentConfig: ContentConfig = {
+  title: "通用订单对账管理",
+  columns,
+  apis: {
+    httpList
+  }
+};
+
+export default contentConfig;

+ 49 - 0
src/views/InvoiceSales/currentcyOrderRecord/config/search.config.ts

@@ -0,0 +1,49 @@
+import { FormConfig } from "/@/components/PageSearch";
+import { tagTypeOptions } from "/@/views/purchase/orderRecord/config/_options";
+
+import { statusOptions } from "./_options";
+
+const searchFormConfig: FormConfig = {
+  formItems: [
+    {
+      field: 'timer',
+      type: 'date_picker',
+      otherOptions: {
+        type: 'daterange',
+        startProp: 'start',
+        endProp: 'end',
+        startPlaceholder: '开始时间',
+        endPlaceholder: '结束时间'
+      }
+    },
+    {
+      field: 'supplierNo',
+      type: 'supplier-query'
+    },
+    {
+      field: 'companyNo',
+      type: 'business-query'
+    },
+    {
+      field: 'payNo',
+      type: 'input',
+      placeholder: '对账编号'
+    },
+    {
+      field: 'tag_status',
+      type: 'select',
+      span: '4',
+      placeholder: '标签状态',
+      options: tagTypeOptions
+    },
+    {
+      field: 'status',
+      type: 'select',
+      placeholder: '状态',
+      span: '4',
+      options: statusOptions
+    }
+  ]
+};
+
+export default searchFormConfig;

+ 55 - 0
src/views/InvoiceSales/currentcyOrderRecord/detail.vue

@@ -0,0 +1,55 @@
+<script setup lang="ts">
+import { ref, computed, shallowRef } from 'vue'
+import { useDetail } from "/@/hooks/core/useDetail";
+import { usePermission } from "/@/hooks/core/usePermission";
+import ReconciliationForm from "/@/components/ReconciliationForm";
+import { DefaultApprovalNode } from "/@/components/ApprovalNode";
+
+const pageName = "currentcyOrderRecordDetail"
+
+const { id, title, isDetail, collapses } = useDetail({
+  baseName: '订单对账',
+  collapseLen:2
+});
+
+const loading = shallowRef(false);
+
+const { hasPermissionWithCode } = usePermission(pageName);
+
+function handleCreate() { 
+
+}
+
+function handleApproval() { 
+
+}
+
+</script>
+
+
+<template>
+  <div class="padding__container">
+    <ElTabs>
+      <ElTabPane :label="title">
+        <ElCollapse v-model="collapses">
+          <ElCollapseItem name="1" :title="title">
+            <ReconciliationForm
+              :id="id"
+              ref="formRef"
+              :loading="loading"
+              :readonly="isDetail"
+              @create="handleCreate"
+              isPurch
+            />
+          </ElCollapseItem>  
+
+          <template v-if="isDetail">
+            <ElCollapseItem name="2" title="买入公司审核" v-if="hasPermissionWithCode('039')">
+               <DefaultApprovalNode approveValue="2" rejectValue="3" @approval="handleApproval" />
+            </ElCollapseItem>
+          </template>
+        </ElCollapse>  
+      </ElTabPane>
+    </ElTabs>
+  </div>
+</template>

+ 44 - 0
src/views/InvoiceSales/currentcyOrderRecord/index.vue

@@ -0,0 +1,44 @@
+<script setup lang="ts">
+import { useRouter } from "vue-router"
+import contentConfig from "./config/content.config";
+import searchConfig from "./config/search.config";
+import { usePageSearch, type PageHooks, type PageEvents } from "/@/hooks/page";
+import { usePermission } from "/@/hooks/core/usePermission";
+
+const pageName = "currentcyOrderRecord";
+
+const { push } = useRouter();
+
+
+const { hasPermissionWithCode } = usePermission(pageName);
+
+const hooks: PageHooks = {
+  pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig)
+};
+
+const events: PageEvents = {
+  content: {
+    preview: ({ payNo }) => push('/InvoiceSales/currentcyOrderRecordDetail?id=' + payNo)
+  }
+};
+</script>
+
+<template>
+  <PageAuth :pageName="pageName">
+    <PageContainer
+      :hooks="hooks"
+      :events="events"
+      :contentConfig="contentConfig"
+      :search-config="searchConfig"
+    >
+      <template #content_header>
+        <ElButton
+          type="primary"
+          v-if="hasPermissionWithCode('002')"
+          @click="push('/InvoiceSales/currentcyOrderRecordDetail')"
+          >添加</ElButton
+        >
+      </template>
+  </PageContainer>
+  </PageAuth>
+</template>

+ 0 - 0
src/views/InvoiceSales/currentcyOrderRecord/通用订单对账管理


+ 2 - 2
src/views/purchase/orderRecord/config/content.config.ts

@@ -1,7 +1,7 @@
 import { httpList, httpDel } from "/@/api/purchase/orderRecord";
+import { ContentConfig } from "/@/components/PageContent";
 
 import { statusOptions, payStatusOptions, invStatusOptions } from "./_options";
-import { ContentConfig } from "/@/components/PageContent";
 import { renderIconLabelLeft, renderProp } from "/@/utils/columnRenderHelper";
 import { hasAccountOptions } from "/@/utils/status";
 
@@ -66,7 +66,7 @@ const columns = [
     prop: "companyName",
     minWidth: 180,
     align: "left",
-      ...renderIconLabelLeft('companyNo','companyName','买入方公司:')
+    ...renderIconLabelLeft('companyNo', 'companyName', '买入方公司:')
   },
 
   {

+ 1 - 1
src/views/supply/orderRecord/index.vue

@@ -20,7 +20,7 @@ const { push } = useRouter();
 const selectlist = ref<any[]>([]);
 const loading = ref(false);
 
-//{ code: "031", name: "下载批量开票模板" }
+// { code: "031", name: "下载批量开票模板" }
 const { hasPermissionWithCode } = usePermission(PageName);
 
 const hooks: PageHooks = {

+ 10 - 16
src/views/supply/ticketReturn/components/execl-files-upload/columns-config.ts

@@ -1,26 +1,20 @@
 const initheaders = [
-  "卖方公司编码",
+  "买方公司编码",
+  "回票申请编码",
   "对账编码",
-  "发票类型",
-  "发票代码",
-  "发票号码",
-  "发票税前金额",
-  "开票日期",
-  "校验码(电子票必填,全电票不需要)"
+  "审核状态",
+  "审核备注"
 ];
 
 export const mapProp = {
-  value0: "supplierNo",
-  value1: "payNo",
-  value2: "invoiceType",
-  value3: "invoiceCode",
-  value4: "invoiceNumber",
-  value5: "inv_subtotal_amount",
-  value6: "open_time",
-  value7: "checkNumber"
+  value0: "companyNo",
+  value1: "hpNo",
+  value2: "payNo",
+  value3: "status",
+  value4: "remark"
 };
 
-export const requireHeaders = [];
+export const requireHeaders = ["payNo", "companyNo", "hpNo", "status"];
 
 const columns = () => {
   const list: any[] = [

+ 68 - 67
src/views/supply/ticketReturn/components/execl-files-upload/index.vue

@@ -2,7 +2,7 @@
 import { ref } from "vue";
 import { ElMessage } from "element-plus";
 import { execlUpload } from "/@/components/execlUpload";
-import { httpBatchAdd } from "/@/api/purchase/ticketReturn";
+import { httpBatchimport } from "/@/api/purchase/ticketReturn";
 import { useResponseHandle } from "/@/hooks";
 import { useCompany } from "/@/hooks/core/useCompany";
 
@@ -12,7 +12,6 @@ import {
   mapProp,
   requireHeaders
 } from "./columns-config";
-import { cg_inv_type_list } from "/@/utils/status";
 
 const visible = ref(false);
 const loading = ref(false);
@@ -20,13 +19,6 @@ const tableData = ref([]);
 const columnsConfig = columns();
 const emit = defineEmits(["onSuccess"]);
 
-const allTypes = cg_inv_type_list.map(({ label }) => label);
-
-const row = ref(1);
-
-const createInvErrorMessage = (row: string) =>
-  `导入数据第 ${row} 行 发票类型格式不正确,发票类型必须为${allTypes.join(",")}`;
-
 const { currentCompany } = useCompany();
 
 const responseHandle = useResponseHandle();
@@ -58,18 +50,19 @@ const Uploadsuccess = ({ results, header }) => {
   }
   tableData.value = [];
 
-  for (const v1 of results) {
-    const b = Object.values(v1);
-    let model = {};
-    b.forEach((si, sii) => {
-      model["value" + sii] = si + "";
-    });
-    tableData.value.push(model);
-
-    row.value = row.value + 1;
+  try {
+    for (const v1 of results) {
+      const b = Object.values(v1);
+      let model = {};
+      b.forEach((si, sii) => {
+        model["value" + sii] = si + "";
+      });
+      tableData.value.push(model);
+    }
+    loading.value = false;
+  } catch (err) {
+    return err;
   }
-
-  loading.value = false;
 };
 //提交
 const handleSubmit = async () => {
@@ -77,6 +70,9 @@ const handleSubmit = async () => {
   loading.value = true;
 
   const data = [];
+  const errorStatus = [];
+  const errorHp = [];
+  const errorDz = [];
 
   tableData.value.forEach((key, index) => {
     const obj: Record<string, string> = {};
@@ -84,75 +80,77 @@ const handleSubmit = async () => {
     for (let i in key) {
       const prop = mapProp[i];
       const value = key[i];
-      obj[prop] = value;
+      if (prop === "status") {
+        const trimValue = value.trim();
+        if (trimValue !== "通过" && trimValue !== "驳回") {
+          errorStatus.push(index + 1);
+        } else {
+          obj[prop] = trimValue === "通过" ? "4" : "7";
+        }
+      } else if (prop === "hpNo") {
+        if (!value) errorHp.push(index + 1);
+        obj[prop] = value;
+      } else if (prop === "payNo") {
+        if (!value) errorDz.push(index + 1);
+        obj[prop] = value;
+      } else {
+        obj[prop] = value;
+      }
     }
     data.push(obj);
   });
 
-  const typeErrors: string[] = [];
-  const checkErrors: string[] = [];
-
-  data.forEach((row, index) => {
-    const source = row.invoiceType.trim();
-    const target = cg_inv_type_list.find(({ label }) => label === source);
-
-    if (!target) {
-      typeErrors.push(String(index + 1));
-    } else {
-      row.invoiceType = target.value;
-
-      if (
-        (target.value === "normal" || target.value === "electronic") &&
-        !row.checkNumber
-      ) {
-        checkErrors.push(String(index + 1));
-      }
-    }
-
-    console.log(row);
-  });
+  const buyers = data.map(({ companyNo }) => companyNo);
+  const setBuyers = [...new Set(buyers)];
 
-  if (typeErrors.length > 0) {
-    ElMessage({
-      type: "error",
-      message: createInvErrorMessage(typeErrors.join(","))
-    });
+  if (errorStatus.length > 0) {
+    ElMessage.error(
+      `第 ${errorStatus.join(",")} 行审核状态格式不正确,应该为'通过',或'驳回'`
+    );
     loading.value = false;
     return;
   }
 
-  if (checkErrors.length > 0) {
-    ElMessage({
-      type: "error",
-      message: `第 ${checkErrors.join(",")} 行,校验码不能为空。`
-    });
+  if (errorHp.length > 0) {
+    ElMessage.error(
+      `第 ${errorHp.join(",")} 行格式不正确,回票申请编码为必填项`
+    );
     loading.value = false;
     return;
   }
 
-  const buyers = data.map(({ supplierNo }) => supplierNo);
-  const setBuyers = [...new Set(buyers)];
-
-  if (setBuyers.length > 1) {
-    ElMessage.error("卖方公司编码不一致");
+  if (errorDz.length > 0) {
+    ElMessage.error(`第 ${errorDz.join(",")} 行格式不正确,对账编码为必填项`);
     loading.value = false;
     return;
   }
 
-  if (setBuyers[0] !== currentCompany.value.companyNo) {
-    ElMessage.error("卖方公司编码与当前选择的公司不一致");
+  if (setBuyers.length > 1) {
+    ElMessage.error("买方公司编码不一致");
     loading.value = false;
     return;
   }
 
+  // if (setBuyers[0] !== currentCompany.value.companyNo) {
+  //   ElMessage.error("买方公司编码与当前选择的公司不一致");
+  //   loading.value = false;
+  //   return;
+  // }
+
+
+
+  const companyNo = data[0].companyNo
+
   data.forEach(item => {
-    delete item["supplierNo"];
+    delete item["payNo"];
+    delete item["companyNo"];
   });
 
-  const { code, message } = await httpBatchAdd({
+  const { code, message } = await httpBatchimport({
     list: data,
-    companyNo: currentCompany.value.companyNo,
-    relaComNo: currentCompany.value.companyNo
+    companyNo,
+    emptyRela:true
+    // relaComNo
   });
 
   loading.value = false;
@@ -160,7 +158,6 @@ const handleSubmit = async () => {
   responseHandle({
     code,
     message,
-    noMessage: false,
     handler: () => {
       ElMessage.success("数据导入成功!");
       emit("onSuccess");
@@ -180,7 +177,7 @@ defineExpose({
   <el-dialog
     :close-on-click-modal="false"
     v-model="visible"
-    title="导入批量开票数据"
+    title="批量导入认证结果"
     width="1040px"
     top="8vh"
     center
@@ -237,4 +234,8 @@ defineExpose({
   </el-dialog>
 </template>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+:deep(.el-upload-list__item) {
+  display: none !important;
+}
+</style>

+ 5 - 8
src/views/supply/ticketReturn/config/xls-template.ts

@@ -1,10 +1,7 @@
 export const template = {
-  卖方公司编码: "GS2203161858475687",
-  对账编码: "PAY2212021733183187",
-  发票类型: "增值税电子普通发票",
-  发票代码: "11002000711",
-  发票号码: "51678540",
-  发票税前金额: "4900",
-  开票日期: "2020-12-17",
-  "校验码(电子票必填,全电票不需要)": ""
+  买方公司编码: "",
+  回票申请编码: "",
+  对账编码: "",
+  审核状态: "",
+  审核备注: ""
 };

+ 26 - 2
src/views/supply/ticketReturn/index.vue

@@ -12,6 +12,9 @@ import { PageContent } from "/@/components/PageContent";
 import ExeclUpoad from "./components/execl-files-upload/index.vue";
 import { usePermission } from "/@/hooks/core/usePermission";
 import { useUserInfo } from "/@/hooks/core/useUser";
+import { utils, writeFile } from "xlsx";
+
+import { template } from "./config/xls-template";
 
 const PageName = "supplyTicketReturn";
 const baseUrl = "/supply/supplyTicketReturnDetail";
@@ -41,6 +44,19 @@ const events: PageEvents = {
   }
 };
 
+//导出模板
+function onDownloadTemplate() {
+  //创建数据表
+  const workBook = utils.book_new();
+  const workSheet = utils.json_to_sheet([template]);
+  utils.book_append_sheet(workBook, workSheet, "sheet");
+
+  //导出模板
+  writeFile(workBook, "回票批量导入模板.xlsx", {
+    bookType: "xlsx"
+  });
+}
+
 async function handleDownload() {
   await httpRequsetExport({
     url: "ile",
@@ -77,10 +93,18 @@ async function handleDownload() {
 
         <ElButton
           size="small"
-          v-if="hasPermissionWithCode('033') && !isSuperUser"
+          v-if="hasPermissionWithCode('018') && !isSuperUser"
           :icon="useRenderIcon('arrow-up-line')"
           @click="() => execelUploadRef.onDisplay()"
-          >批量创建开票数据</ElButton
+          >批量导入认证结果</ElButton
+        >
+
+        <ElButton
+          size="small"
+          v-if="hasPermissionWithCode('019')"
+          :icon="useRenderIcon('arrow-down-line')"
+          @click="() => onDownloadTemplate()"
+          >下载回票批量申请模板</ElButton
         >
       </template>
 

+ 23 - 10
src/views/supplyInvoiceSaleSettings/_component/execl-files-upload/columns-config.ts

@@ -1,10 +1,17 @@
 const initheaders = [
   "商品编码",
+  "商品名称",
+  "买入方公司编码",
+  "买入方公司名称",
+  "卖出方公司编码",
+  "卖出方公司名称",
   "采购税率",
   "采购类目编码",
+  "采购类目名称",
   "采购开票商品名称",
   "财务税率",
   "财务类目编码",
+  "财务类目名称",
   "财务开票商品名称",
   "税率标识",
   "是否有优惠政策",
@@ -13,15 +20,22 @@ const initheaders = [
 
 export const mapProp = {
   value0: "spuCode",
-  value1: "cg_tax",
-  value2: "cg_cat_code",
-  value3: "cg_inv_good_name",
-  value4: "tax",
-  value5: "cat_code",
-  value6: "inv_good_name",
-  value7: "inv_tag",
-  value8: "is_discount",
-  value9: "addTax"
+  value1: "spuName",
+  value2: "buyerCompanyCode",
+  value3: "buyerCompanyName",
+  value4: "sellerCompanyCode",
+  value5: "sellerCompanyName",
+  value6: "cg_tax",
+  value7: "cg_cat_code",
+  value8: "cg_cat_name",
+  value9: "cg_inv_good_name",
+  value10: "tax",
+  value11: "cat_code",
+  value12: "cat_name",
+  value13: "inv_good_name",
+  value14: "inv_tag",
+  value15: "is_discount",
+  value16: "addTax"
 };
 
 export const requireHeaders = [
@@ -49,7 +63,6 @@ const columns = () => {
     });
   });
 
-  console.log(list);
   return list;
 };
 

+ 2 - 1
src/views/supplyInvoiceSaleSettings/_component/execl-files-upload/index.vue

@@ -45,7 +45,7 @@ const Uploadsuccess = ({ results, header }) => {
     return;
   }
 
-  console.log(header.length,initheaders.length)
+  console.log(header, initheaders)
   let headok = true;
   if (header.length !== initheaders.length) {
     headok = false;
@@ -57,6 +57,7 @@ const Uploadsuccess = ({ results, header }) => {
     });
   }
 
+
   if (!headok) {
     ElMessage.error("表头与导入模板不匹配!");
     loading.value = false;

+ 14 - 4
src/views/supplyInvoiceSaleSettings/_component/procure-import/columns-config.ts

@@ -1,5 +1,10 @@
 const initheaders = [
   "商品编码",
+  "商品名称",
+  "买入方公司编码",
+  "买入方公司名称",
+  "卖出方公司编码",
+  "卖出方公司名称",
   "税率",
   "类目编码",
   "开票商品名称",
@@ -7,9 +12,14 @@ const initheaders = [
 
 export const mapProp = {
   value0: "spuCode",
-  value1: "tax",
-  value2: "cat_code",
-  value3: "inv_good_name",
+  value1: "spuName",
+  value2: "companyNo",
+  value3: "companyName",
+  value4: "suppplierNo",
+  value5: "supplierName",
+  value6: "tax",
+  value7: "cat_code",
+  value8: "inv_good_name",
 };
 
 export const requireHeaders = [
@@ -31,7 +41,7 @@ const columns = () => {
     list.push({
       prop: "value" + sii,
       label: si,
-      minWidth: sii === 0 || sii === 1 ? "120px" : "90px"
+      minWidth: sii === 0 || sii === 1 ? "120px" : "120px"
     });
   });
 

+ 12 - 0
src/views/supplyInvoiceSaleSettings/_config/xls-template.ts

@@ -1,10 +1,17 @@
 export const template = {
   商品编码: "",
+  商品名称: "",
+  买入方公司编码: "",
+  买入方公司名称: "",
+  卖出方公司编码: "",
+  卖出方公司名称: "",
   采购税率: "",
   采购类目编码: "",
+  采购类目名称: "",
   采购开票商品名称: "",
   财务税率: "",
   财务类目编码: "",
+  财务类目名称: "",
   财务开票商品名称: "",
   税率标识: "",
   是否有优惠政策: "",
@@ -14,6 +21,11 @@ export const template = {
 
 export const procureTemplate = {
   商品编码: "",
+  商品名称: "",
+  买入方公司编码: "",
+  买入方公司名称: "",
+  卖出方公司编码: "",
+  卖出方公司名称: "",
   税率: "",
   类目编码: "",
   开票商品名称: "",

+ 27 - 1
src/views/supplyInvoiceSaleSettings/supplyCommodityCost/index.vue

@@ -39,6 +39,17 @@ function toDetail(spuCode) {
   });
 }
 
+const mapTag = {
+  "1": "免税",
+  "2": "不征税",
+  "3": "零税率"
+};
+
+const mapDiscount = {
+  "1": "是",
+  "0": "否"
+};
+
 function onDownloadTemplate(isProcure = false) {
   if (selects.value.length === 0) {
     ElMessage.warning("请选择至少一个商品");
@@ -54,16 +65,31 @@ function onDownloadTemplate(isProcure = false) {
 
     if (isProcure) { // 采购
       _template["商品编码"] = item.spuCode;
+      _template["商品名称"] = item.good_name;
+      _template["买入方公司编码"] = item.companyNo;
+      _template["买入方公司名称"] = item.companyName;
+      _template["卖出方公司编码"] = item.supplierNo;
+      _template["卖出方公司名称"] = item.supplierName;
       _template["开票商品名称"] = item.cgd_inv_good_name;
     } else {  // 财务
       _template["商品编码"] = item.spuCode;
+      _template["商品名称"] = item.good_name;
+      _template["买入方公司编码"] = item.companyNo;
+      _template["买入方公司名称"] = item.companyName;
+      _template["卖出方公司编码"] = item.supplierNo;
+      _template["卖出方公司名称"] = item.supplierName;
       _template["采购类目编码"] = item.cgd_inv_cat_code;
+      _template['采购类目名称'] = item.cgd_inv_cat_name;
       _template["采购开票商品名称"] = item.cgd_inv_good_name;
       _template['采购税率'] = item.cgd_inv_tax ? (((item.cgd_inv_tax.split("%"))[0]) / 100).toFixed(2) : "";
-
       _template['财务类目编码'] = item.inv_cat_code;
+      _template['财务类目名称'] = item.inv_cat_name;
       _template['财务开票商品名称'] = item.inv_good_name;
       _template['财务税率'] = item.inv_tax ? (((item.inv_tax.split("%"))[0]) / 100).toFixed(2) : ""
+
+      _template['税率标识'] = item.inv_tag && item.inv_tag !== "0" ? mapTag[item.inv_tag] : "";
+      _template["是否有优惠政策"] = Number(item.status) >= 2 ? mapDiscount[item.is_discount] : "";
+      _template["增值税管理内容"] = item.addTax;
     }
 
     data.push(_template);

+ 28 - 2
src/views/supplyInvoiceSaleSettings/supplyConsultingCost/index.vue

@@ -36,6 +36,17 @@ function toDetail(spuCode) {
   });
 }
 
+const mapTag = {
+  "1": "免税",
+  "2": "不征税",
+  "3": "零税率"
+};
+
+const mapDiscount = {
+  "1": "是",
+  "0": "否"
+};
+
 function onDownloadTemplate(isProcure = false) {
   if (selects.value.length === 0) {
     ElMessage.warning("请选择至少一个商品");
@@ -51,18 +62,33 @@ function onDownloadTemplate(isProcure = false) {
 
     if (isProcure) { // 采购
       _template["商品编码"] = item.spuCode;
+      _template["商品名称"] = item.good_name;
+      _template["买入方公司编码"] = item.companyNo;
+      _template["买入方公司名称"] = item.companyName;
+      _template["卖出方公司编码"] = item.supplierNo;
+      _template["卖出方公司名称"] = item.supplierName;
       _template["开票商品名称"] = item.cgd_inv_good_name;
     } else {  // 财务
       _template["商品编码"] = item.spuCode;
+      _template["商品名称"] = item.good_name;
+      _template["买入方公司编码"] = item.companyNo;
+      _template["买入方公司名称"] = item.companyName;
+      _template["卖出方公司编码"] = item.supplierNo;
+      _template["卖出方公司名称"] = item.supplierName;
       _template["采购类目编码"] = item.cgd_inv_cat_code;
+      _template['采购类目名称'] = item.cgd_inv_cat_name;
       _template["采购开票商品名称"] = item.cgd_inv_good_name;
       _template['采购税率'] = item.cgd_inv_tax ? (((item.cgd_inv_tax.split("%"))[0]) / 100).toFixed(2) : "";
-
       _template['财务类目编码'] = item.inv_cat_code;
+      _template['财务类目名称'] = item.inv_cat_name;
       _template['财务开票商品名称'] = item.inv_good_name;
       _template['财务税率'] = item.inv_tax ? (((item.inv_tax.split("%"))[0]) / 100).toFixed(2) : ""
+
+      _template['税率标识'] = item.inv_tag && item.inv_tag !== "0" ? mapTag[item.inv_tag] : "";
+      _template["是否有优惠政策"] = Number(item.status) >= 2 ? mapDiscount[item.is_discount] : "";
+      _template["增值税管理内容"] = item.addTax;
     }
-     
+
     data.push(_template);
   });