snow 4 months ago
parent
commit
bce224cf31
22 changed files with 1609 additions and 274 deletions
  1. 2 2
      .env.development
  2. 110 31
      src/components/FundDetail/index.vue
  3. 6 24
      src/hooks/core/useCompany.ts
  4. 16 0
      src/views/InvoiceSales/batchImportYunlong/InvoiceTitle.vue
  5. 45 0
      src/views/InvoiceSales/batchImportYunlong/ProcessModal.vue
  6. 120 0
      src/views/InvoiceSales/batchImportYunlong/columns.ts
  7. 161 0
      src/views/InvoiceSales/batchImportYunlong/index.vue
  8. 92 0
      src/views/InvoiceSales/batchImportYunlong/validator.ts
  9. 10 12
      src/views/InvoiceSales/capitalClaim/components/basic-claim/receipt-payment.vue
  10. 223 0
      src/views/InvoiceSales/capitalClaim/components/execl-files-business-upload/columns-config.ts
  11. 217 0
      src/views/InvoiceSales/capitalClaim/components/execl-files-business-upload/index.vue
  12. 0 1
      src/views/InvoiceSales/capitalClaim/components/execl-files-upload/columns-config.ts
  13. 144 61
      src/views/InvoiceSales/capitalClaim/config/content.config.ts
  14. 43 13
      src/views/InvoiceSales/capitalClaim/config/xls-template.ts
  15. 0 21
      src/views/InvoiceSales/capitalClaim/detail.vue
  16. 48 38
      src/views/InvoiceSales/capitalClaim/index.vue
  17. 293 0
      src/views/InvoiceSales/capitalPool/base-form/currentcy-modal.vue
  18. 13 9
      src/views/InvoiceSales/capitalPool/base-form/index.vue
  19. 44 57
      src/views/InvoiceSales/capitalPool/base-form/sales-modal.vue
  20. 11 2
      src/views/InvoiceSales/capitalPool/detail.vue
  21. 10 3
      src/views/InvoiceSales/invoiceApply/components/currentcy-form/add-edit-form.vue
  22. 1 0
      src/views/InvoiceSales/sheetOrderPool/index.vue

+ 2 - 2
.env.development

@@ -22,7 +22,7 @@ VITE_PROXY_USER_REAL = "http://stockinv.test241.wanyuhengtong.com"
 # 开发环境后端业务地址
 VITE_PROXY_DOMAIN_REAL = "http://stockinv.test241.wanyuhengtong.com"
 
-VITE_WORKORDER_REAL = "http://project.test241.wanyuhengtong.com/"
+VITE_WORKORDER_REAL = "http://project.test241.wanyuhengtong.com"
 VITE_IS_PROD = true
 # 跳转结算地址
 VITE_PURCHASE_URL = 'http://webstock3.test241.wanyuhengtong.com/'
@@ -31,4 +31,4 @@ VITE_DASHBOARD_URL = 'http://web.report.caixiao365.com/'
 # token密钥
 VITE_SECRET_KEY = 'key123'
 # 跳转工单地址
-VITE_GD_URL = 'http://work.test241.wanyuhengtong.com/'
+VITE_GD_URL = 'http//bugweb.test241.wanyuhengtong.com/'

+ 110 - 31
src/components/FundDetail/index.vue

@@ -1,10 +1,11 @@
 <script setup lang="ts">
 import { h } from "vue"
 import BasicDescriptions from "/@/components/BasicDescriptions";
-import { ElTag } from "element-plus"
+import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
+import { ElTag, ElTooltip, ElButton } from "element-plus"
 
-defineProps<{ tradeInfo: Record<string, string>; }>();
 
+defineProps<{ tradeInfo: Record<string, string>; }>();
 
 const status_options = [
   { label: "未认领", value: "1" },
@@ -13,42 +14,120 @@ const status_options = [
 ]
 
  const columns = [
-  { label: "资金编码", span: 8, field: "tradNo" },
-  {
-    label: "状态",
-    field: "status",
-    slot: "status",
-    span: 8,
-    render(status) {
-      return h(
-        ElTag,
-        { size: "small" },
-        { default: () => status_options.find(s => s.value === String(status))?.label }
-      );
+  { label: "资金编码", span: 6, field: "tradNo" },
+  { label: '业务类型', span: 6, field: 'TODO'},
+  { label: '创建人', field: 'apply_name', span: 6 },
+  { label: '创建时间', field: 'addtime', span: 6 },
+  {
+    label: '业务公司名称',
+    span: 12,
+    render(_, row){
+      return h('div', {  style: 'display:flex' }, {
+        default: () =>  ([
+          h(ElTooltip, { content: '业务公司编码:' + row.companyNo, placement: 'top' }, { default: () => h(ElButton, { icon: useRenderIcon('information-line'), link: true, type: 'info' }) }),
+          row.trade_in
+        ])
+      })
     }
   },
-  { label: "新建时间", span: 8, field: "addtime" },
-  { label: "收入金额", span: 8, field: "total_fee" },
-  { label: "未认领金额", span: 8, field: "balance" },
-  { label: "已认领金额", span: 8, field: "used_fee" },
-  { label: '收款公司', field: 'trade_in', span: 8, },
-  { label: '收款公司账户', field: 'trade_in_account', span: 8 },
-  { label: '平台订单客户名称', field: 'customerName', span: 8 },
-  { label: "交易用途", span: 24, field: "trade_used" },
-  { label: "ND编号", field: "NdCode", span: 24 },
-  { label: "平台订单编号", field: "poCode", span: 24 },
-  { label: '付款单位名称', field: 'trade_out', span: 8 },
-  { label: '账户', field: 'trade_account', span: 8 },
-  { label: '交易时间', field: 'addtime', span: 8 },
-  { label: "交易行名",  field: 'trade_bank', span: 16 },
-  { label: '创建人', field: 'apply_name', span: 8 }
-  // { label: "付款方省市", span: 12, field: "" }
+  {
+    field: 'TODO',
+    label: '业务公司收入总价',
+    span: 6
+  },
+  {
+    field: 'addtime',
+    label: "交易时间",
+    span: 6
+  },
+  {
+    label: '收款方公司名称',
+    span: 12,
+    render(_, row){
+      return h('div', {  style: 'display:flex' }, {
+        default: () =>  ([
+          h(ElTooltip, { content: '收款方公司编码:' + row.companyNo, placement: 'top' }, { default: () => h(ElButton, { icon: useRenderIcon('information-line'), link: true, type: 'info' }) }),
+          row.trade_in
+        ])
+      })
+    }
+  },
+  {
+    span: 12,
+    label: '收款方公司账号',
+    field: 'trade_in_account'
+  },
+  {
+    span: 12,
+    label: '客服付款信息'
+  },
+  {
+    span: 12,
+    label: '客户机构名称'
+  },
+  {
+    span: 24,
+    label: '客户PO'
+  },
+  {
+    span: 24,
+    field: 'NdCode',
+    label: '客户DN'
+  },
+  {
+    span: 24,
+    label: '交易用途'
+  },
+  // {
+  //   label: "状态",
+  //   field: "status",
+  //   slot: "status",
+  //   span: 8,
+  //   render(status) {
+  //     return h(
+  //       ElTag,
+  //       { size: "small" },
+  //       { default: () => status_options.find(s => s.value === String(status))?.label }
+  //     );
+  //   }
+  // },
+  // { label: "新建时间", span: 8, field: "addtime" },
+  // { label: "收入金额", span: 8, field: "total_fee" },
+  // { label: "未认领金额", span: 8, field: "balance" },
+  // { label: "已认领金额", span: 8, field: "used_fee" },
+  // { label: '收款公司', field: 'trade_in', span: 8, },
+  // { label: '收款公司账户', field: 'trade_in_account', span: 8 },
+  // { label: '平台订单客户名称', field: 'customerName', span: 8 },
+  // { label: "交易用途", span: 24, field: "trade_used" },
+  // { label: "ND编号", field: "NdCode", span: 24 },
+  // { label: "平台订单编号", field: "poCode", span: 24 },
+  // { label: '付款单位名称', field: 'trade_out', span: 8 },
+  // { label: '账户', field: 'trade_account', span: 8 },
+  // { label: '交易时间', field: 'addtime', span: 8 },
+  // { label: "交易行名",  field: 'trade_bank', span: 16 },
 ];
 
+
+const columns_bottom = [
+  { label: '泰e购SKU', span: 6 },
+  { label: '产品数量', span: 6 },
+  { label: '业务公司收入单价', span: 6 },
+  { label: '业务公司收入总价', span: 6 },
+  { label: '平台物料名称', span: 6 },
+  { label: '税率', span: 6 },
+  { label: '税目', span: 12 },
+  { label: '平台采购PO', span: 12 },
+  { label: '平台收入单价', span: 6 },
+  { label: '平台收入总价', span: 6 }
+]
+
 </script>
 
 <template>
-   <BasicDescriptions ref="defaultRef1" :data="tradeInfo" :columns="columns" />
+   <div class="flex flex-col">
+      <BasicDescriptions class="mb-[20px]" :data="tradeInfo" :columns="columns" />
+      <BasicDescriptions :data="tradeInfo" :columns="columns_bottom" />
+   </div>
 </template>
 
 <style lang="scss" scoped>

+ 6 - 24
src/hooks/core/useCompany.ts

@@ -8,46 +8,28 @@ export function useCompany() {
   const { SET_CURRENT_COMPANY } = useUserStoreHook();
   const companyList = computed(() => useUserStoreHook().companyList);
 
-  const currentCompany = computed(
-    () => useUserStoreHook().currentCompany || {}
-  );
-
+  const currentCompany = computed(() => useUserStoreHook().currentCompany || {});
+  const setCompanyList = (list) => { useUserStoreHook().companyList = list;}
   const isSwitchingCompany = computed(() => useUserStoreHook().swithingCompany)
 
-  const setCompanyList = (list) => {
-    useUserStoreHook().companyList = list;
-  }
-
-  const setSwithingComapny = (state: boolean) => useUserStoreHook().swithingCompany = state;
+  const setSwithingCompany = (state: boolean) => useUserStoreHook().swithingCompany = state;
 
 
   function setCurrentCompany(value, list?: any) {
     const filter: any = ({ companyCode }) => companyCode === value;
-
     const _list = list ? list : companyList.value;
-
     const company = _list.find(filter);
-
     if (company && company.companyCode) company.companyNo = company.companyCode
-
-    SET_CURRENT_COMPANY(
-      isSuperUser.value
-        ? {
-          companyName: value?.name || '所有公司',
-          companyNo: value?.code || ''
-        }
-        : company
-    );
-
+    SET_CURRENT_COMPANY(isSuperUser.value ? { companyName: value?.name || '所有公司', companyNo: value?.code || '' } : company);
     return company
   }
 
   return {
     companyList,
     currentCompany,
+    setCompanyList,
     setCurrentCompany,
     isSwitchingCompany,
-    setSwithingComapny,
-    setCompanyList
+    setSwithingCompany
   };
 }

+ 16 - 0
src/views/InvoiceSales/batchImportYunlong/InvoiceTitle.vue

@@ -0,0 +1,16 @@
+<script setup lang="ts">
+import { invoice_columns } from "./columns";
+import BasicDescriptions from "/@/components/BasicDescriptions";
+
+defineProps<{ detail: Record<string, string>; }>();
+</script>
+
+<template>
+  <BasicDescriptions
+    v-if="Object.keys(detail || {}).length !== 0"
+    :columns="invoice_columns"
+    label-width="130"
+    :col-number="1"
+    :data="detail"
+  />
+</template>

+ 45 - 0
src/views/InvoiceSales/batchImportYunlong/ProcessModal.vue

@@ -0,0 +1,45 @@
+<script setup lang="ts">
+import { useVModel } from "@vueuse/core"
+import InvoiceTitle from "./InvoiceTitle.vue"
+
+const props = defineProps<{ visible: boolean, purchaserInvoiceTitle: any; sellerInvoiceTitle: any }>()
+const visible = useVModel(props, 'visible')
+
+
+</script>
+
+<template>
+  <ElDialog width="1200px" v-model="visible" title="提交中..." center>
+    <ElForm>
+      <ElRow :gutter="10">
+        <ElCol :span="12">
+          <ElFormItem label="销售方公司抬头">
+            <div class="flex flex-col w-full">
+              <ElInput 
+                :modelValue="(sellerInvoiceTitle || {}).invoice_title" 
+                class="mb-[10px]" 
+                disabled 
+              />
+
+              <InvoiceTitle :detail="sellerInvoiceTitle || {}" />
+            </div>
+          </ElFormItem>
+        </ElCol>
+
+        <ElCol :span="12">
+          <ElFormItem label="购买方公司抬头">
+            <div class="flex flex-col w-full">
+              <ElInput
+                :modelValue="(purchaserInvoiceTitle || {}).invoice_title" 
+                class="mb-[10px]" 
+                disabled
+              />
+
+              <InvoiceTitle :detail="purchaserInvoiceTitle || {}" />
+            </div>
+          </ElFormItem>
+        </ElCol>
+      </ElRow>
+    </ElForm>
+  </ElDialog>
+</template>

+ 120 - 0
src/views/InvoiceSales/batchImportYunlong/columns.ts

@@ -0,0 +1,120 @@
+export const initialColumns = [
+  {
+    label: '分组',
+    minWidth: '80px',
+    prop: 'group',
+    required: true
+  },
+  {
+    label: '发票类型',
+    minWidth: '140px',
+    prop: 'invtype',
+    required: true
+  },
+  {
+    label: '电子邮箱',
+    minWidth: '140px',
+    prop: 'email',
+    required: true
+  },
+  {
+    label: '订单编号',
+    minWidth: '140px',
+    prop: 'sequenceNo',
+    required: true
+  },
+  {
+    label: '订单平台类型',
+    minWidth: '120px',
+    prop: 'platform_type',
+    required: true
+  },
+  {
+    label: '开票金额',
+    minWidth: '160px',
+    prop: 'inv_fee',
+    required: true
+  },
+  {
+    label: '平台采购PO',
+    minWidth: '160px',
+    prop: 'poCode',
+    required: true
+  },
+  {
+    label: '状态',
+    minWidth: '160px',
+    prop: 'status',
+    required: true
+  },
+  {
+    label: '备注',
+    minWidth: '160px',
+    prop: 'remark',
+    required: true
+  }
+]
+
+export const columns = [{ type: "index", width: "50", fixed: "left", label: "序号" }, ...initialColumns]
+
+export const getPropertyAsLabel = (label: string) =>  { return initialColumns.find((column) => column.label === label)?.prop }
+
+export const requiredColumns = initialColumns.filter(({ required }) => !!required)
+
+export const mapPropertyToLabel = initialColumns.reduce((prev, current) => ({...prev, [current.prop]: current.label }), {})
+
+
+export const invoice_columns = [
+  { label: "抬头", span: 24, field: "invoice_title" },
+  { label: "纳税人识别号", span: 24, field: "invoice_code" },
+];
+
+
+/**
+ * @invoice_addr 公司注册地址
+ * @invoice_people  法人
+ * @invoice_mobile 联系方式
+ * @invoice_code 纳税识别号
+ * @invoice_bank 开户行
+ * @invoice_bankNo 开户账户
+ */
+export const convertInvoiceTitle = (title: Record<string, string>) => {
+  const {
+    company_address,
+    mobile,
+    company_license,
+    bank_name,
+    bankNo,
+    company_name
+  } = title;
+
+  return {
+    invoice_addr: company_address,
+    invoice_mobile: mobile,
+    invoice_code: company_license,
+    invoice_bank: bank_name,
+    invoice_bankNo: bankNo,
+    invoice_title: company_name
+  };
+};
+
+export const convertInvoiceTitleData = (title: Record<string, string>) => {
+  const {
+    invoice_addr,
+    invoice_mobile,
+    invoice_code,
+    invoice_bank,
+    invoice_bankNo,
+    invoice_title
+  } = title;
+
+  return {
+    invoice_code,
+    invoice_title,
+    addrAndmobile: invoice_addr + " " + invoice_mobile,
+    bankAndBankNo: invoice_bank + " " + invoice_bankNo
+  };
+};
+
+
+

+ 161 - 0
src/views/InvoiceSales/batchImportYunlong/index.vue

@@ -0,0 +1,161 @@
+<script setup lang="ts">
+import { ref, reactive } from "vue";
+import { execlUpload as ExcelUpload } from "/@/components/execlUpload";
+import { columns, initialColumns, getPropertyAsLabel, convertInvoiceTitle, convertInvoiceTitleData  } from "./columns";
+import { responseHandle } from "/@/utils/responseHandle";
+import { useCompany } from "/@/hooks/core/useCompany";
+import { httpList } from "/@/api/parameter/finance";
+import { useResponseHandle } from "/@/hooks";
+import { ElMessage } from "element-plus";
+
+import { isValidHeader, isImportDataValid  } from "./validator"
+
+import InvoiceTitle from "./InvoiceTitle.vue"
+import ProcessModal from "./ProcessModal.vue"
+
+const emit = defineEmits(["onSuccess"]);
+
+const tableData = ref([]);
+const loading = ref(false);
+const { currentCompany } = useCompany();
+const responseHandle = useResponseHandle();
+
+const state = reactive({  visible: false, loading: false })
+
+
+const sellerInvoiceTitle = ref<Record<string, string>>({});
+const purchaserInvoiceTitle = ref<Record<string, string>>({});
+
+const setSellerInvoiceTitle = handleInvoiceTitle.bind(null, true);
+const setPurchaserInvoiceTitle = handleInvoiceTitle.bind(null, false);
+
+function handleInvoiceTitle(_isSeller: boolean, invoiceTitle: Record<string, string>) {
+  if (!invoiceTitle) { return _isSeller ? (sellerInvoiceTitle.value = {}) : (purchaserInvoiceTitle.value = {})}
+  if (_isSeller) {
+    //支持的开票方式
+    const { invoiceType, denomination: _denomination } = invoiceTitle;
+    const chunks = invoiceType.split(",");
+    sellerInvoiceTitle.value = convertInvoiceTitleData(convertInvoiceTitle(invoiceTitle))
+  } else {
+    purchaserInvoiceTitle.value = convertInvoiceTitleData(convertInvoiceTitle(invoiceTitle));
+  }
+}
+
+const visibleHeader = ref(false)
+const importHeader = ref([])
+
+const initialHeader = initialColumns.slice(0, 7).map(({ label }) => label)
+
+function onUploadSuccess({ results, header }){
+  if(!isValidHeader(initialHeader, header)){ return }
+
+  const list = []
+  for(const result of results){
+    const item = {}
+    Object.keys(result).forEach(label => {
+      const property = getPropertyAsLabel(label)
+      item[property] = result[label]
+    })
+    list.push(item)
+  }
+
+  // 排序group
+  list.sort((a, b) => a.group - b.group)
+  if(!isImportDataValid(list)){ return }
+}
+
+
+const handleProcess = () => state.visible = true 
+const clearData = () => tableData.value = []
+
+async function setTitle(companyNo, isSeller = true) {
+  state.loading = true
+  const { code, data, message } = await httpList({ companyNo });
+  state.loading = false
+
+  responseHandle({
+    code,
+    message,
+    handler: () => isSeller ? setSellerInvoiceTitle(data.list[0]) : setPurchaserInvoiceTitle(data.list[0])
+  });
+}
+
+
+currentCompany.value.companyNo && setTitle(currentCompany.value.companyNo)
+setTitle('GS2404151642335170', false)
+</script>
+
+<template>
+  <div 
+    class="flex flex-col bg-white justify-start items-start" 
+    style="height:calc(100vh - 48px);width: 100%"
+    v-loading="state.loading"
+  >
+    <div class="flex w-full">
+      <ElForm label-width="120px">
+        <ElRow>
+          <ElCol :span="12">
+            <ElFormItem label="销售方公司抬头">
+              <InvoiceTitle  :detail="sellerInvoiceTitle" />
+            </ElFormItem>
+          </ElCol>
+
+          <ElCol :span="12">
+            <ElFormItem label="购买方公司抬头">
+              <InvoiceTitle  :detail="purchaserInvoiceTitle" />
+            </ElFormItem>
+          </ElCol>
+        </ElRow>
+      </ElForm>
+    </div>
+
+    <ExcelUpload 
+      v-if="tableData.length === 0" 
+      style="height:auto !important" 
+      @onSuccess="onUploadSuccess" 
+    />
+
+    <ElTag class="mb-[10px]">
+      {{ tableData.length }} / 300
+    </ElTag>
+    
+    <ElTable
+      stripe
+      border
+      size="small"
+      :data="tableData"
+      max-height="500px"
+      style="width: 100%"
+    >
+      <ElTableColumn v-for="(column, index) in columns" v-bind="column" :key="index" show-overflow-tooltip>
+        <template #header>
+          <span v-if="!column?.required">{{ column.label }}</span>
+          <p v-else>
+            <span style="color: #f56c6c; font-size: 14px">* </span>
+            {{ column.label }}
+          </p>
+        </template>
+      </ElTableColumn>
+    </ElTable>
+    
+    <div class="w-full flex justify-end" v-if="tableData.length !== 0" style="padding: 10px 0 0 0">
+      <ElButton  @click="clearData">取消</ElButton>
+      
+      <ElButton 
+        type="primary" 
+        :loading="loading"
+        @click="handleProcess"
+        >批量创建</ElButton>
+    </div>
+
+    <ProcessModal 
+      v-model:visible="state.visible"
+      :sellerInvoiceTitle="sellerInvoiceTitle"
+      :purchaserInvoiceTitle="purchaserInvoiceTitle"
+    />
+  </div>
+</template>
+
+<style lang="scss" scoped>
+:deep(.el-upload-list__item) { display: none !important; }
+</style>

+ 92 - 0
src/views/InvoiceSales/batchImportYunlong/validator.ts

@@ -0,0 +1,92 @@
+import { ElMessage, ElMessageBox } from "element-plus"
+import { requiredColumns, mapPropertyToLabel } from "./columns"
+import { h } from "vue"
+
+const requiredProps = requiredColumns.map(({ prop }) => prop)
+
+export function isValidHeader(header: any[], importHeader: any[]){
+  if(header.length !== importHeader.length){
+    ElMessage.warning('导入文件表头与模板不一致')
+    return false
+  }
+
+  for(const index in header){
+    const head = header[index].trim()
+    const importHead = importHeader[index].trim()
+    if(head !== importHead){
+      ElMessage.warning('导入文件表头与模板不一致')
+      return false
+    }
+  }
+
+  return true
+}
+
+
+function isValidGroupNumber(results){
+  const groups = [...new Set(results.map(({ group }) => group))]
+  if(groups[0] != 1){
+    ElMessage.warning('分组编号必须从1开始')
+    return false
+  }
+  const max = groups[groups.length - 1]
+  const nGroup = Array(max).fill(0).map((_, index) => index + 1)
+  if(groups.length !== nGroup.length){
+    const nums = nGroup.filter(group => !groups.includes(group))
+    ElMessage.warning('分组必须为连续编号,缺少分组: ' + nums.join('、'))
+    return false
+  }
+  return true
+}
+
+
+function onDisplayErrorMessage(errors){
+  ElMessageBox({
+    title: '数据校验失败',
+    type: 'warning',
+    message: h('div', { style: 'display: flex, flex-direction:column' }, {
+      default: () => Object.keys(errors).reduce((prev, index) => {
+        return [
+          ...prev,
+          h('p',{}, '第' + (Number(index) + 1) + '行, ' + errors[index])
+        ]
+      }, [])
+    })
+  })
+}
+
+function isValidRequired(results: any[]){
+  const errors = {}
+    
+  for(const index in results){
+    const item = results[index]
+    for(const key in item){
+      const value = item[key]
+      if(requiredProps.includes(key) && (!value || !String(value).trim())){
+        if(errors[index]) {
+          errors[index] = errors[index] += '、' + mapPropertyToLabel[key]
+        } else{
+          errors[index] = mapPropertyToLabel[key]
+        }
+      }
+    }
+
+    if(errors[index]){  errors[index] += ',不能为空' }
+  }
+
+
+  if(Object.keys(errors).length === 0){
+    return true
+  } else {
+    onDisplayErrorMessage(errors)
+    return
+  }
+}
+
+
+export function isImportDataValid(results: any[]){
+  /* 校验必填字段是否填入 */
+  if(!isValidRequired(results)){ return false }
+  /* 校验分组是否合理 */
+  if(!isValidGroupNumber(results)) { return false }
+}

+ 10 - 12
src/views/InvoiceSales/capitalClaim/components/basic-claim/receipt-payment.vue

@@ -1,21 +1,19 @@
 <script setup lang="ts">
-import {
-  description_columns_in,
-  description_columns_out,
-  public_columns
-} from "../../config/configs";
+import { public_columns } from "../../config/configs";
+
+
 import BasicDescriptions from "/@/components/BasicDescriptions";
-defineProps<{
-  tradeInfo: Record<string, string>;
-}>();
+
+defineProps<{ tradeInfo: Record<string, string> }>();
 </script>
 
 <template>
-   <BasicDescriptions ref="defaultRef1" :data="tradeInfo" :columns="public_columns" />
+   <BasicDescriptions 
+    :data="tradeInfo" 
+    :columns="public_columns" 
+  />
 </template>
 
 <style lang="scss" scoped>
-:deep(.el-descriptions__label) {
-  width: 80px !important;
-}
+:deep(.el-descriptions__label) { width: 80px !important; }
 </style>

+ 223 - 0
src/views/InvoiceSales/capitalClaim/components/execl-files-business-upload/columns-config.ts

@@ -0,0 +1,223 @@
+const initheaders = [
+  "业务公司编码",
+  "业务公司名称",
+  "收款方公司编码",
+  "收款方公司名称",
+  "收款方账户",
+  "交易时间",
+  "客户机构名称",
+  "客户付款银行户名",
+  "客户PO",
+  "ND编号",
+  "平台采购PO",
+  "泰e购SKU",
+  "平台物料名称",
+  "产品数量",
+  "平台公司收入单价",
+  "平台公司收入总价",
+  "税率(%)",
+  "税收编码",
+  "业务公司收入单价",
+  "业务公司收入总价",
+  "交易用途",
+  "创建人",
+  "创建时间"
+];
+
+export const requireHeaders = [
+  "收款方公司编码",
+  "收款方账户",
+  "交易时间",
+  "收入金额",
+  "交易行名",
+  "对方账号",
+  "对方户名"
+];
+
+const getValueName = (label: string) => 'value' + initheaders.findIndex(item => item === label)
+console.log(getValueName)
+
+export const requsetHeaderIdxs = [
+  getValueName('收款方公司编码'),
+  getValueName('收款方账户'),
+  getValueName('交易时间'),
+  getValueName('收入金额'),
+  getValueName('交易行名'),
+  getValueName('对方账号'),
+  getValueName('对方户名'),
+];
+
+
+export const initialColumns = [
+  {
+    label: '业务公司编码',
+    width: '130px',
+    prop: 'companyNo',
+    required: true
+  },
+  {
+    label: '业务公司名称',
+    width: '130px',
+    prop: 'companyName',
+    required: true
+  },
+  {
+    label: '收款方公司编码',
+    width: '160px',
+    prop: 'TODO1',
+    required: true
+  },
+  {
+    label: '收款方公司名称',
+    width: '160px',
+    prop: 'TODO2',
+    required: true
+  },
+  {
+    label: '收款方账户',
+    width: '140px',
+    prop: 'TODO3',
+    required: true
+  },
+  {
+    label: '交易时间',
+    width: '120px',
+    prop: 'tradeTime',
+    required: true
+  },
+  {
+    label: '客户机构名称',
+    width: '140px',
+    prop: 'TODO5',
+    required: true
+  },
+  {
+    label: '客户付款银行户名',
+    width: '160px',
+    prop: 'TODO6',
+    required: true
+  },
+  {
+    label: '客户付款行名',
+    width: '160px',
+    prop: 'TODO22',
+    required: true
+  },
+  {
+    label: '客户付款银行账号',
+    width: '160px',
+    prop: 'TODO23',
+    required: true
+  },
+  {
+    label: '客户PO',
+    width: '140px',
+    prop: 'TODO7',
+    required: true
+  },
+  {
+    label: 'ND编号',
+    width: '120px',
+    prop: 'TODO8',
+    required: true
+  },
+  {
+    label: '平台采购PO',
+    width: '120px',
+    prop: 'TODO9',
+    required: true
+  },
+  {
+    label: '泰e购SKU',
+    width: '120px',
+    prop: 'TODO10',
+    required: true
+  },
+  {
+    label: '平台物料名称',
+    width: '140px',
+    prop: 'TODO11',
+    required: true
+  },
+  {
+    label: '产品数量',
+    width: '120px',
+    prop: 'TODO12',
+    required: true
+  },
+  {
+    label: '平台公司收入单价',
+    width: '140px',
+    prop: 'TODO13',
+    required: true
+  },
+  {
+    label: '平台公司收入总价',
+    width: '140px',
+    prop: 'TODO14',
+    required: true
+  },
+  {
+    label: '税率(%)',
+    width: '120px',
+    prop: 'TODO15',
+    required: true
+  },
+  {
+    label: '税收编码',
+    width: '120px',
+    prop: 'TODO16',
+    required: true
+  },
+  {
+    label: '税收编码名称',
+    width: '120px',
+    prop: 'TODO16',
+    required: true
+  },
+  {
+    label: '业务公司收入单价',
+    width: '160px',
+    prop: 'TODO17',
+    required: true
+  },
+  {
+    label: '业务公司收入总价',
+    width: '160px',
+    prop: 'TODO18',
+    required: true
+  },
+  {
+    label: '交易用途',
+    width: '120px',
+    prop: 'TODO19',
+    required: true
+  },
+  {
+    label: '创建人',
+    width: '100px',
+    prop: 'TODO20',
+  },
+  {
+    label: '创建时间',
+    width: '100px',
+    prop: 'TODO21',
+  }
+]
+
+const columns = () => {
+  const list: any[] = [
+    {
+      type: "index",
+      width: "50",
+      fixed: "left",
+      label: "序号"
+    },
+    ...initialColumns
+  ];
+  return list;
+};
+
+export const getPropertyAsLabel = (label: string) =>  initialColumns.find((column) => column.label === label)?.prop
+
+export { initheaders  ,columns };

+ 217 - 0
src/views/InvoiceSales/capitalClaim/components/execl-files-business-upload/index.vue

@@ -0,0 +1,217 @@
+<script setup lang="ts">
+import { ref } from "vue";
+import { httpUpload } from "/@/api/InvoiceSales/capitalClaim";
+import { columns, initialColumns, requsetHeaderIdxs, getPropertyAsLabel } from "./columns-config";
+import { ElMessage, ElNotification } from "element-plus";
+import { responseHandle } from "/@/utils/responseHandle";
+import { execlUpload } from "/@/components/execlUpload";
+import { useNav } from "/@/layout/hooks/nav";
+
+
+const visible = ref(false);
+const loading = ref(false);
+const tableData = ref([]);
+const columnsConfig = columns();
+const { logout } = useNav();
+
+const emit = defineEmits(["onSuccess"]);
+
+const visibleHeader = ref(false)
+const importHeader = ref([])
+
+const Uploadsuccess = ({ results, header }) => {
+  loading.value = true;
+  if (results.length === 0) {
+    ElMessage.error("表格无有效数据!");
+    loading.value = false;
+    return;
+  }
+
+  let headOk = true;
+  const initHeader = initialColumns.map(({label}) => label)
+  if (header.length !== initialColumns.length) {
+    headOk = false;
+  } else {
+    initHeader.forEach((si, sii) => { if (si !== header[sii]) { headOk = false; }});
+  }
+
+  if (!headOk) {
+    visibleHeader.value = true
+    importHeader.value = [...header]
+    loading.value = false;
+    return;
+  }
+
+  tableData.value = [];
+  let isDateError = false
+
+  
+  try {
+    results.forEach(v1 => {
+      const item: Record<string, any> = {}
+      Object.keys(v1).forEach(label => { item[getPropertyAsLabel(label)] = v1[label] })
+      if(item.tradeTime.indexOf('-') === -1){ isDateError = true }
+      tableData.value.push(item);
+    });
+
+
+    loading.value = false;
+    if(isDateError){
+      tableData.value = []
+      ElMessage.error("交易时间格式错误,应为:2020-01-01");
+      return
+    }
+  } catch (e) {
+    ElMessage.error("导入数据拼接有误!");
+    loading.value = false;
+  }
+};
+
+
+const mapToProp = {
+  value0: 'companyNo',
+  value1: 'trade_in',
+  value2: 'trade_in_account',
+  value3: 'NdCode',
+  value4: 'poCode',
+  value5: 'customerName',
+  value6: 'tradeTime',
+  value7: 'trade_fee',
+  value8: 'balance',
+  value9: 'trade_bank',
+  value10: 'trade_account',
+  value11: 'trade_out',
+  value12: 'trade_used',
+}
+
+//提交
+const handleSubmit = async () => {
+  if (loading.value) return;
+  loading.value = true;
+  let isOk = true, isNum = true, data = [];
+  const requestProperties = initialColumns.filter(item => !!item.required).map(({prop}) => prop)
+
+
+  tableData.value.forEach(keys => {
+    let arr = {}
+    
+    for (let key in keys) {
+      arr[key] = keys[key]
+      if (requestProperties.includes(key) && !keys[key]) {  isOk = false;  }
+    }
+    
+    data.push({ ...arr, trade_remark: '' });
+  });
+
+  if (!isOk) {
+    ElNotification({
+      title: "必填字段缺失!",
+      type: "error"
+    });
+    
+    loading.value = false;
+    return;
+  }
+
+  if (!isNum) {
+    ElMessage.error("收入金额只能为正数!");
+    loading.value = false;
+    return;
+  }
+
+  const { code, message } = await httpUpload({ data });
+  loading.value = false;
+
+  responseHandle({
+    code,
+    message,
+    logout,
+    handler: () => {
+      visible.value = false;
+      ElMessage.success("数据导入成功!");
+      emit("onSuccess");
+    }
+  });
+};
+
+const cancel = () => { tableData.value = []; };
+defineExpose({ onDisplay: () => {
+  console.log(requsetHeaderIdxs)
+  visible.value = true;
+  tableData.value = [];
+} });
+</script>
+
+<template>
+  <el-dialog
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    v-model="visible"
+    title="导入平台公司资金数据"
+    width="1040px"
+    top="8vh"
+    center
+  >
+    <execlUpload
+      v-if="tableData.length === 0"
+      @on-success="Uploadsuccess" 
+    />
+    
+    <el-table
+      stripe
+      border
+      size="small"
+      :data="tableData"
+      max-height="500px"
+      style="width: 100%"
+    >
+      <el-table-column
+        v-for="(si, sii) in columnsConfig"
+        :width="si.width"
+        :fixed="si.fixed"
+        :type="si.type"
+        :prop="si.prop"
+        :key="sii"
+        show-overflow-tooltip
+      >
+        <template #header>
+          <span v-if="!si.required">{{ si.label }}</span>
+
+          <p v-else>
+            <span style="color: #f56c6c; font-size: 14px">* </span>
+            {{ si.label }}
+          </p>
+        </template>
+      </el-table-column>
+    </el-table>
+    <div
+      flex
+      justify-end
+      gap-2
+      v-if="tableData.length !== 0"
+      style="padding: 10px 0 0 0"
+    >
+      <el-button size="small" @click="cancel">取消</el-button>
+      <el-button
+        size="small"
+        type="primary"
+        :loading="loading"
+        @click="handleSubmit"
+        >保存</el-button
+      >
+    </div>
+
+    <el-dialog v-model="visibleHeader" title="导入文件表头与模板表头不一致,当前导入文件表头为:" :close-on-click-modal="false"
+    :close-on-press-escape="false">
+      <el-table border size="small">
+        <el-table-column v-for="column in importHeader" fit :label="column.indexOf('UNKNOWN') !== -1 ? '' : column" />
+      </el-table>
+    </el-dialog>
+  </el-dialog>
+</template>
+
+<style lang="scss" scoped>
+:deep(.el-upload-list__item) {
+  display: none !important;
+}
+</style>

+ 0 - 1
src/views/InvoiceSales/capitalClaim/components/execl-files-upload/columns-config.ts

@@ -9,7 +9,6 @@ const initheaders = [
   "收入金额",
   "账号余额",
   "交易行名",
-  // "对方省市",
   "对方账号",
   "对方户名",
   "交易用途"

+ 144 - 61
src/views/InvoiceSales/capitalClaim/config/content.config.ts

@@ -14,92 +14,179 @@ const columns = [
     width: 150
   },
   {
-    label: '平台订单编号',
-    prop: 'poCode',
-    width: 150
+    label: '业务类型',
+    width: 120
+  },
+  {
+    label: '业务公司编码',
+    width: 160
+  },
+  {
+    label: '业务公司名称',
+    width: 160
+  },
+  {
+    label: '收款方公司编码',
+    width: 160
   },
   {
-    label: "状态",
-    prop: "status",
-    width: 100,
-    cellRenderer: ({ row, props }) =>
-      h(
-        ElTag,
-        {
-          size: props.size
-        },
-        {
-          default: () => {
-            const status = row.logNo ? CAPITAL_STATUS : capital_status;
-            return (
-              status.find(s => String(row.status) === String(s.value))?.label ||
-              "--"
-            );
-          }
-        }
-      )
+    label: '收款方公司名称',
+    width: 160
   },
   {
-    label: "收入金额",
-    prop: "total_fee",
+    label: '收款方账户',
     width: 120
   },
   {
-    label: "未认领金额",
-    prop: "balance",
+    label: '交易时间',
     width: 120
   },
   {
-    label: "已认领金额",
-    prop: "used_fee",
+    label: '客户机构名称',
     width: 120
   },
   {
-    label: "交易用途",
-    prop: "trade_used",
+    label: '客户付款银行户名',
     width: 120
   },
   {
-    label: "交易时间",
-    prop: "trade_time",
-    width: 140
+    label: '客户付款行名',
+    width: 120
   },
   {
-    label: "付款单位名称",
-    prop: "trade_out",
-    width: 160
+    label: '客户付款银行账号',
+    width: 120
   },
   {
-    label: "付款单位账号",
-    prop: "trade_account",
-    width: 160
+    label: '客户PO',
+    width: 120
   },
-
   {
-    label: "收款公司账户",
-    prop: "trade_in_account",
-    width: 145
+    label: '客户DN',
+    width: 120
   },
   {
-    label: "交易行名",
-    prop: "trade_bank",
-    width: 160
+    label: '平台采购PO',
+    width: 120
+  },
+  {
+    label: '泰e购SKU',
+    width: 120
+  },
+  {
+    label: '平台物料名称',
+    width: 120
+  },
+  {
+    label: '产品数量',
+    width: 120
+  },
+  {
+    label: '平台公司收入单价',
+    width: 120
+  },
+  {
+    label: '平台公司收入总价',
+    width: 120
+  },
+  {
+    label: '交易用途',
+    width: 120
   },
+  {
+    label: '创建人',
+    width: 120
+  },
+  {
+    label: '创建时间',
+    width: 120
+  },
+  // {
+    // label: '平台订单编号',
+  //   prop: 'poCode',
+  //   width: 150
+  // },
+  // {
+  //   label: "状态",
+  //   prop: "status",
+  //   width: 100,
+  //   cellRenderer: ({ row, props }) =>
+  //     h(
+  //       ElTag,
+  //       {
+  //         size: props.size
+  //       },
+  //       {
+  //         default: () => {
+  //           const status = row.logNo ? CAPITAL_STATUS : capital_status;
+  //           return (
+  //             status.find(s => String(row.status) === String(s.value))?.label ||
+  //             "--"
+  //           );
+  //         }
+  //       }
+  //     )
+  // },
+  // {
+  //   label: "收入金额",
+  //   prop: "total_fee",
+  //   width: 120
+  // },
+  // {
+  //   label: "未认领金额",
+  //   prop: "balance",
+  //   width: 120
+  // },
+  // {
+  //   label: "已认领金额",
+  //   prop: "used_fee",
+  //   width: 120
+  // },
+  // {
+  //   label: "交易用途",
+  //   prop: "trade_used",
+  //   width: 120
+  // },
+  // {
+  //   label: "交易时间",
+  //   prop: "trade_time",
+  //   width: 140
+  // },
+  // {
+  //   label: "付款单位名称",
+  //   prop: "trade_out",
+  //   width: 160
+  // },
+  // {
+  //   label: "付款单位账号",
+  //   prop: "trade_account",
+  //   width: 160
+  // },
+  // {
+  //   label: "收款公司账户",
+  //   prop: "trade_in_account",
+  //   width: 145
+  // },
+  // {
+  //   label: "交易行名",
+  //   prop: "trade_bank",
+  //   width: 160
+  // },
   // {
   //   label: "收款公司编码",
   //   prop: "companyNo",
   //   width: 150
   // },
-  {
-    label: "收款公司名称",
-    prop: "trade_in",
-    width: 145
-  },
-  {
-    label: "资金导入时间",
-    prop: "addtime",
-    width: 140
-  },
+  // {
+  //   label: "收款公司名称",
+  //   prop: "trade_in",
+  //   width: 145
+  // },
+  // {
+  //   label: "资金导入时间",
+  //   prop: "addtime",
+  //   width: 140
+  // },
   {
     label: "操作",
     fixed: "right",
@@ -112,11 +199,7 @@ const contentConfig: ContentConfig = {
   title: "资金认领管理",
   columns,
   isTree: true,
-  showDelete({ status } ={}, isSuperUser ) {
-    console.log(status, isSuperUser)
-    
-    return status == '1' && !isSuperUser
-  },
+  showDelete({ status } ={}, isSuperUser ) { return status == '1' && !isSuperUser },
   apis: {
     httpList: httpNewList,
     httpDelete

+ 43 - 13
src/views/InvoiceSales/capitalClaim/config/xls-template.ts

@@ -1,20 +1,50 @@
 export const template = {
-  收款方公司编码: "",
-  收款方公司名称: "",
-  收款方账户: "",
-  ND编号: "",
-  平台订单编号: "",
-  订单客户名称: "",
-  交易时间: "",
-  收入金额: "",
-  账号余额: "",
-  交易行名: "",
+  收款方公司编码: "GS2302231124114965",
+  收款方公司名称: "北京普润心堂商贸有限公司",
+  收款方账户: "9550880042966400187",
+  ND编号: "DN20240822174723373",
+  平台订单编号: "PO190020240800409752",
+  订单客户名称: "泰康人寿保险有限责任公司河北分公司",
+  交易时间: "2023-12-25",
+  收入金额: "200",
+  账号余额: "0",
+  交易行名: "兴业银行总行",
   // 对方省市: "",
-  对方账号: "",
-  对方户名: "",
-  交易用途: ""
+  对方账号: "11120901040013561",
+  对方户名: "泰康保险集团股份有限公司",
+  交易用途: "DN20240822174723373/PO190020240800409752"
 };
 
+export const template2 = {
+  业务公司编码: 'GS2302231125079621',
+  业务公司名称: '北京百辰荣达国际科贸有限公司',
+  收款方公司编码: "Sqm37231225172818001",
+  收款方公司名称: "元隆",
+  收款方账户: "9550880042966400000",
+  交易时间: "2023-12-25",
+  客户机构名称: '泰康人寿保险有限责任公司河北分公司',
+  客户付款银行户名: '泰康保险集团股份有限公司',
+  客户付款行名: '兴业银行总行',
+  客户付款银行账号: 11120901040013561,
+  客户PO: "PO190020240800409752",
+  ND编号: "DN20240822174723373",
+  平台采购PO: "PO-YL31-2024-1546",
+  "泰e购SKU": "SKU20240906100039001",
+  平台物料名称: "AI音箱",
+  产品数量: "1",
+  平台公司收入单价: "243.04",
+  平台公司收入总价: "243.04",
+  "税率(%)": "13",
+  税收编码: "1090519060000000000",
+  税收编码名称: "电子元件",
+  业务公司收入单价: "200",
+  业务公司收入总价: "200",
+  交易用途: "DN20240822174723373/PO190020240800409752",
+  创建人: "",
+  创建时间: ""
+};
+
+
 export const capitalTemplate = {
   收款方公司编码: "",
   收款方公司名称: "",

+ 0 - 21
src/views/InvoiceSales/capitalClaim/detail.vue

@@ -1,21 +0,0 @@
-<script setup lang="ts">
-import { computed } from "vue";
-import { useRoute } from "vue-router";
-import CapitalClaim from "./components/capitalDetail/index.vue";
-
-const { query } = useRoute();
-const id = computed(() => query.id as string);
-</script>
-
-<template>
-  <div class="invoice__content" bg-white>
-    <h1 mb-2 font-bold>认领详情</h1>
-    <CapitalClaim :id="id" />
-  </div>
-</template>
-
-<style>
-.invoice__content {
-  padding: 30px !important;
-}
-</style>

+ 48 - 38
src/views/InvoiceSales/capitalClaim/index.vue

@@ -7,43 +7,34 @@ import { PageContent } from "/@/components/PageContent";
 import PagePower from "/@/components/PagePower/PagePower.vue";
 import ExeclUpload from "./components/execl-files-upload/index.vue";
 import ExeclCapitalUpload from "./components/execl-capital-files-upload/index.vue";
+
+import ExcelBusinessUpload from "./components/execl-files-business-upload/index.vue"
 import searchFormConfig from "./config/search.config";
 import contentConfig from "./config/content.config";
-import { template, capitalTemplate } from "./config/xls-template";
-import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
+import { template, template2 ,capitalTemplate } from "./config/xls-template";
 import { usePermission } from "/@/hooks/core/usePermission";
 import { useUserInfo } from "/@/hooks/core/useUser";
 import { useAsync } from "/@/hooks/core/useAsync";
-import { CAPITAL_STATUS } from "/@/utils/details/tragelog";
 import { httpWithdraw } from "/@/api/InvoiceSales/capitalClaim";
 import { httpRequsetExport } from "/@/utils/export";
 import { useCompany } from "/@/hooks/core/useCompany";
-
 import { httpInfo } from "/@/api/InvoiceSales/capitalClaim";
 import { useTask } from "/@/hooks/core"
 
-
 import FundDetail from "/@/components/FundDetail/index.vue"
-
 import { ElMessage } from "element-plus"
 import dayjs from "dayjs"
 
-import {
-  xs_order_source_options,
-  xs_order_type_options
-} from "/@/utils/status";
 
 const { push } = useRouter();
-
 const detailTask = useTask({ initialData: {} })
 
-const execlUploadRef = ref<InstanceType<typeof ExeclUpload>>(null);
-const execlCapitalUploadRef = ref<InstanceType<typeof ExeclCapitalUpload>>(null);
+const execlUploadRef = ref<InstanceType<typeof ExeclUpload> | null>(null);
+const execlCapitalUploadRef = ref<InstanceType<typeof ExeclCapitalUpload> | null>(null);
+const execlBusinessUploadRef = ref<InstanceType<typeof ExcelBusinessUpload> | null>(null)
+
 const pageName = "capitalClaim";
 
-const { run: withDraw } = useAsync({
-  success: () => pageContentRef.value.onSearch()
-});
 
 //  { code: "009", name: "撤销资金认领" },
 //  { code: "029", name: "下载资金导入模板" },
@@ -51,21 +42,16 @@ const { run: withDraw } = useAsync({
 //  { code: "034", name: "下载订单认款导入模板" },
 //  { code: "035", name: "批量导入订单认款数据" }
 
-const { hasPermissionWithCode, permissions } = usePermission(pageName);
-
 const loading = ref(false);
 const visible = ref(false)
 
-const { currentCompany } = useCompany();
+const { run: withDraw } = useAsync({ success: () => pageContentRef.value.onSearch() });
+const { hasPermissionWithCode, permissions } = usePermission(pageName);
 
+const { currentCompany } = useCompany();
 const { isSuperUser } = useUserInfo();
 
-const { pageContentRef, handleResetClick, handleSearchClick } = usePageSearch(
-  undefined,
-  undefined,
-  searchFormConfig
-);
-
+const { pageContentRef, handleResetClick, handleSearchClick } = usePageSearch(undefined, undefined, searchFormConfig);
 const handleWithDraw = data => withDraw(httpWithdraw(data));
 
 //导出模板
@@ -74,12 +60,18 @@ 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"
-  });
+  writeFile(workBook, "资金认领模板.xlsx", { bookType: "xlsx" });
+}
+
+function onDownloadCapitalTemplate(){
+  const workBook = utils.book_new()
+  const workSheet = utils.json_to_sheet([template2])
+  utils.book_append_sheet(workBook, workSheet, "sheet")
+  writeFile(workBook, '平台公司资金导入模板.xlsx', { bookType: 'xlsx' })
 }
+
+
 //导出模板
 function onCapitalDownloadTemplate() {
   //创建数据表
@@ -90,10 +82,8 @@ function onCapitalDownloadTemplate() {
   writeFile(workBook, "订单认款导入模板.xlsx", { bookType: "xlsx" });
 }
 
-
 async function onDownloadCapitalInfo() {
-  const params = pageContentRef.value.getBasicParams()
-
+  const params = pageContentRef.value.getBasicForm()
   if (!params.start || !params.end) {
     ElMessage.warning('请选择导出的时间区间')
     return
@@ -101,6 +91,7 @@ async function onDownloadCapitalInfo() {
 
   const start = dayjs(params.start);
   const end = dayjs(params.end);
+  
   const diffDay = start.diff(end, 'days')
   const startDays = start.daysInMonth();
   const endDays = end.daysInMonth();
@@ -116,13 +107,15 @@ async function onDownloadCapitalInfo() {
     onStart: () => (loading.value = true),
     onSuccess: () => (loading.value = false),
     onFail: () => (loading.value = false),
-    params: { ...pageContentRef.value.getBasicParams(), companyNo: currentCompany.value.companyNo}
+    params: { 
+      ...pageContentRef.value.getBasicParams(), 
+      companyNo: currentCompany.value.companyNo
+    }
   });
 }
 
 
 function handleShow(row){
-  console.log(row)
   visible.value = true
   detailTask.run(httpInfo({ tradNo: row.tradNo }))
 }
@@ -146,7 +139,6 @@ function handleShow(row){
                @click="onDownloadTemplate">
                 1.下载资金导入模板
               </el-button>
-
               <el-button
                 type="primary" plain
                 v-if="!isSuperUser && hasPermissionWithCode('030')"
@@ -154,6 +146,12 @@ function handleShow(row){
                 >
                 2.导入客户付款资金数据(批量)
               </el-button>
+              <el-button plain type="warning"  @click="onDownloadCapitalTemplate">
+                3.下载平台公司资金导入模板
+              </el-button>
+              <el-button plain type="primary" @click="execlBusinessUploadRef.onDisplay()">
+                4.导入平台公司导入模板
+              </el-button>
 
               <el-button 
                 type="success" plain
@@ -161,7 +159,7 @@ function handleShow(row){
                 @click="() => onDownloadCapitalInfo()"
                :loading="loading" 
                >
-               3.导出资金信息
+               5.导出资金信息
               </el-button>
             </el-button-group>
            </div>
@@ -177,8 +175,20 @@ function handleShow(row){
       </div>
     </PagePower>
 
-    <ExeclUpload ref="execlUploadRef" @onSuccess="handleResetClick" />
-    <ExeclCapitalUpload ref="execlCapitalUploadRef" @onSuccess="handleResetClick" />
+    <ExeclUpload 
+      ref="execlUploadRef" 
+      @onSuccess="handleResetClick" 
+    />
+
+    <ExeclCapitalUpload 
+      ref="execlCapitalUploadRef" 
+      @onSuccess="handleResetClick" 
+    />
+
+    <ExcelBusinessUpload 
+      ref="execlBusinessUploadRef"
+      @onSuccess="handleResetClick" 
+    />
 
 
     <ElDialog center title="资金详情" v-model="visible">

+ 293 - 0
src/views/InvoiceSales/capitalPool/base-form/currentcy-modal.vue

@@ -0,0 +1,293 @@
+<script setup lang="ts">
+import { httpSaleList } from "/@/api/InvoiceSales/capitalClaim";
+import { onMounted, ref, unref } from "vue";
+import { ElMessage, ElTable } from "element-plus";
+import { useAsync } from "/@/hooks";
+import { send_status_list, useTypeOptions, xs_order_source_options, xs_order_type_options } from "/@/utils/status";
+import { sale_type, sale_columns } from "./configs";
+
+import { useCompany } from "/@/hooks/core/useCompany";
+import { DateRange } from "/@/components/BasicForm";
+
+const visible = ref(false);
+const emit = defineEmits(["save-click-button"]);
+
+const data = ref<Record<string, any>>({
+  timer: [],
+  sequenceNo: "",
+  qrdtype: "",
+  qrdsource: "",
+  customer: "",
+  platName: "",
+  cxCode: "",
+  platform_type: "1",
+  is_comon: '0'
+});
+
+const { currentCompany } = useCompany();
+const tableRef = ref<InstanceType<typeof ElTable>>(null);
+const selectSaleOrder = ref<Array<Record<string, string>>>([]);
+
+const initalPagination = {
+  pageSize: 15,
+  currentPage: 1,
+  total: 0
+};
+
+const {
+  loading,
+  run: salelistRun,
+  data: saleOrderList,
+  pagination
+} = useAsync<Array<Record<string, string>>>({
+  initalData: [],
+  isList: true,
+  initalPagination
+});
+
+const handleSelectChange = values => (selectSaleOrder.value = values);
+
+const requestSalelist = () => {
+  const { currentPage: page, pageSize: size } = pagination;
+  const { timer, ...rest } = data.value;
+  salelistRun(
+    httpSaleList({
+      pay_status: "0",
+      size,
+      page,
+      companyNo: currentCompany.value.companyNo,
+      start: timer[0],
+      end: timer[1],
+      status: '3',
+      ...rest
+    })
+  );
+};
+
+function handleSave() {
+  const wpayZero = selectSaleOrder.value.filter(({wpay_fee}) => Number(wpay_fee) === 0)
+
+  if(wpayZero.length !== 0){
+    ElMessage.warning('添加失败,订单 ' + wpayZero.map(({sequenceNo}) => sequenceNo).join('、') + ' 未付款金额为0')
+    return
+  }
+
+  emit("save-click-button", unref(selectSaleOrder));
+  visible.value = false;
+}
+
+const search = (isReset?: boolean) => {
+  pagination.currentPage = 1;
+  if (isReset) {
+    data.value = {
+      timer: [],
+      sequenceNo: "",
+      qrdtype: "",
+      qrdsource: "",
+      customer: "",
+      platName: "",
+      cxCode: "",
+      platform_type: "1"
+    };
+  }
+  requestSalelist();
+};
+
+function handleSizeChange() {
+  pagination.currentPage = 1;
+  requestSalelist();
+}
+
+defineExpose({
+  onDisplay: (_list: Array<Record<string, string>>) => {
+    visible.value = true;
+    requestSalelist();
+  }
+});
+
+//初始化订单列表
+onMounted(() => requestSalelist());
+</script>
+
+<template>
+  <el-dialog
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    v-model="visible"
+    title="通用订单"
+    width="1040px"
+    @close="() => (selectSaleOrder = [])"
+    top="10px"
+    center
+  >
+    <el-row :gutter="10" style="margin-bottom: 10px">
+      <el-col :span="8">
+        <date-range size="small" v-model="data.timer" />
+      </el-col>
+
+      <el-col :span="8">
+        <el-input
+          v-model="data.sequenceNo"
+          placeholder="订单编码"
+          size="small"
+        />
+      </el-col>
+
+      <el-col :span="8">
+        <el-select
+          class="w-full"
+          size="small"
+          clearable
+          v-model="data.qrdsource"
+          placeholder="订单来源"
+        >
+          <el-option
+            v-for="type in xs_order_source_options"
+            :key="type.value"
+            v-bind="type"
+          />
+        </el-select>
+      </el-col>
+    </el-row>
+
+    <el-row :gutter="10" style="margin-bottom: 10px">
+      <el-col :span="8">
+        <el-select
+          class="w-full"
+          size="small"
+          clearable
+          v-model="data.qrdtype"
+          placeholder="商品类型"
+        >
+          <el-option
+            v-for="type in xs_order_type_options"
+            :key="type.value"
+            v-bind="type"
+          />
+        </el-select>
+      </el-col>
+
+      <el-col :span="8">
+        <el-input placeholder="客户名称" size="small" v-model="data.customer" />
+      </el-col>
+      <el-col :span="8">
+        <el-input placeholder="平台名称" size="small" v-model="data.platName" />
+      </el-col>
+    </el-row>
+
+    <el-row :gutter="10">
+      <el-col :span="8">
+        <el-input
+          placeholder="销售订单主编码"
+          size="small"
+          v-model="data.cxCode"
+        />
+      </el-col>
+
+      <el-col :span="8">
+        <el-switch
+          v-model="data.platform_type"
+          size="small"
+          active-text="toC"
+          inactive-text="toB"
+          active-value="2"
+          inactive-value="1"
+        />
+        <!-- <el-select
+          v-model="data.platform_type"
+          size="small"
+          placeholder="平台类型"
+          style="width: 100%"
+        >
+          <el-option
+            v-for="opt in useTypeOptions"
+            :value="opt.value"
+            :label="opt.label"
+            :key="opt.value"
+          />
+        </el-select> -->
+      </el-col>
+    </el-row>
+
+    <div flex gap-2 justify-end mb-1>
+      <el-button size="small" type="primary" @click="() => search()"
+        >搜索</el-button
+      >
+      <el-button size="small" @click="() => search(true)">重置</el-button>
+    </div>
+
+    <el-table
+      v-loading="loading"
+      :data="saleOrderList"
+      @selection-change="handleSelectChange"
+      ref="tableRef"
+      border
+      size="small"
+      row-key="sequenceNo"
+      max-height="520px"
+    >
+      <el-table-column
+        v-for="(col, index) in sale_columns"
+        :prop="col.field"
+        :label="col.label"
+        :key="index"
+        :width="col.width + 'px'"
+        :fixed="col.fixed"
+        :type="col.type"
+        show-overflow-tooltip
+      >
+        <template #default="{ row }">
+          <el-tag v-if="col.field === 'qrdType'" size="small">
+            {{
+              xs_order_type_options.find(s => s.value === row.qrdType)?.label ||
+              "--"
+            }}
+          </el-tag>
+
+          <el-tag v-else-if="col.field === 'qrdSource'" size="small">
+            {{
+              xs_order_source_options.find(s => s.value === row.qrdSource)
+                ?.label || "--"
+            }}
+          </el-tag>
+
+          <el-tag v-else-if="col.field === 'sendStatus'">
+            {{
+              send_status_list.find(p => String(row.sendStatus) === p.value)
+                ?.label
+            }}
+          </el-tag>
+
+          <el-tag v-if="col.field === 'platform_type'" size="small">
+            {{
+              useTypeOptions.find(s => s.value === row.platform_type)?.label ||
+              "--"
+            }}
+          </el-tag>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <div flex justify-between mt-2>
+      <el-pagination
+        v-model:current-page="pagination.currentPage"
+        v-model:page-size="pagination.pageSize"
+        :total="pagination.total"
+        :page-sizes="[15, 50, 100]"
+        @size-change="handleSizeChange"
+        layout="sizes, prev, pager, next"
+        @current-change="requestSalelist"
+        size="small"
+      />
+
+      <div>
+        <el-button type="primary" @click="handleSave" size="small"
+          >保存</el-button
+        >
+        <el-button @click="() => (visible = false)" size="small"
+          >取消</el-button
+        >
+      </div>
+    </div>
+  </el-dialog>
+</template>

+ 13 - 9
src/views/InvoiceSales/capitalPool/base-form/index.vue

@@ -3,14 +3,16 @@ import { ElMessage } from "element-plus";
 import { computed, ref, unref } from "vue";
 import { order_columns, order_status } from "./configs";
 import { INPUT_MAX_LENGTH } from "/@/utils/global";
-import SalesModal from "./sales-modal.vue";
 import { useTask } from "/@/hooks/core"
 import ChooseModal from "./choose-invoice-modal/index.vue"
 import { httpInfo } from "/@/api/InvoiceSales/capitalClaim";
 import { httpPayAdd } from "/@/api/InvoiceSales/capitalClaim";
 import FundDetail from "/@/components/FundDetail/index.vue"
+import SalesModal from "./sales-modal.vue"
 import { useRouter } from "vue-router"
 
+
+
 const props = defineProps<{ readonly?: boolean; }>();
 const emit = defineEmits(["create-btn-click"]);
 
@@ -49,7 +51,7 @@ function handleCreate() {
   const keys = Object.keys(mapSequenceNoToWpayfee.value);
   keys.forEach(sequenceNo => orderArr.push({ sequenceNo, trad_fee: mapSequenceNoToWpayfee.value[sequenceNo] }));
   
-  if (orderArr.length === 0) {  return ElMessage.error("请添加关联订单"); }
+  if (orderArr.length === 0) { return ElMessage.error("请添加关联订单"); }
   
   const parameter = { tradNo: formData.value.tradNo, orderArr }
   addTask.run(httpPayAdd(parameter))
@@ -61,7 +63,7 @@ function handleDelete(sequenceNo: string) {
 }
 
 
-function handleChoose(row){
+function handleChoose(row = {}){
   detailTask.run(httpInfo({ tradNo: row.tradNo }))
   formData.value.tradNo = row.tradNo
 }
@@ -138,15 +140,17 @@ function handleChoose(row){
        </ElButton>
     </div>
 
-    <SalesModal 
+
+    <SalesModal
+      :isCommon="true"
       ref="saleModalRef"
       @saveClickButton="addSaleOrder" 
     />
-
-
-    <ChooseModal 
-      v-model:visible="visible"
-      @submit="handleChoose"
+    
+    
+    <ChooseModal
+      v-model:visible="visible" 
+      @submit="handleChoose" 
     />
   </div>
 </template>

+ 44 - 57
src/views/InvoiceSales/capitalPool/base-form/sales-modal.vue

@@ -1,14 +1,17 @@
 <script setup lang="ts">
+import { send_status_list, useTypeOptions, xs_order_source_options, xs_order_type_options } from "/@/utils/status";
 import { httpSaleList } from "/@/api/InvoiceSales/capitalClaim";
-import { onMounted, ref, unref } from "vue";
+import { sale_type, sale_columns } from "./configs";
 import { ElMessage, ElTable } from "element-plus";
+import { onMounted, ref, unref, computed } from "vue";
 import { useAsync } from "/@/hooks";
-import { send_status_list, useTypeOptions, xs_order_source_options, xs_order_type_options } from "/@/utils/status";
-import { sale_type, sale_columns } from "./configs";
 
 import { useCompany } from "/@/hooks/core/useCompany";
 import { DateRange } from "/@/components/BasicForm";
 
+const props = defineProps<{ isCommon: boolean }>()
+
+
 const visible = ref(false);
 const emit = defineEmits(["save-click-button"]);
 
@@ -21,13 +24,16 @@ const data = ref<Record<string, any>>({
   platName: "",
   cxCode: "",
   platform_type: "1",
-  is_comon: '0'
+  // is_comon: '0'
 });
 
 const { currentCompany } = useCompany();
 const tableRef = ref<InstanceType<typeof ElTable>>(null);
 const selectSaleOrder = ref<Array<Record<string, string>>>([]);
 
+
+const title = computed(() => props.isCommon ? '通用订单' : '销售订单')
+
 const initalPagination = {
   pageSize: 15,
   currentPage: 1,
@@ -47,18 +53,19 @@ const {
 
 const handleSelectChange = values => (selectSaleOrder.value = values);
 
-const reuquestSalelist = () => {
+const requestSalelist = () => {
   const { currentPage: page, pageSize: size } = pagination;
   const { timer, ...rest } = data.value;
   salelistRun(
     httpSaleList({
-      pay_status: "0",
-      size,
-      page,
       companyNo: currentCompany.value.companyNo,
+      pay_status: "0",
       start: timer[0],
       end: timer[1],
       status: '3',
+      is_comon: props.isCommon ? '1' : '0',
+      size,
+      page,
       ...rest
     })
   );
@@ -66,7 +73,6 @@ const reuquestSalelist = () => {
 
 function handleSave() {
   const wpayZero = selectSaleOrder.value.filter(({wpay_fee}) => Number(wpay_fee) === 0)
-
   if(wpayZero.length !== 0){
     ElMessage.warning('添加失败,订单 ' + wpayZero.map(({sequenceNo}) => sequenceNo).join('、') + ' 未付款金额为0')
     return
@@ -90,67 +96,63 @@ const search = (isReset?: boolean) => {
       platform_type: "1"
     };
   }
-  reuquestSalelist();
+  requestSalelist();
 };
 
 function handleSizeChange() {
   pagination.currentPage = 1;
-  reuquestSalelist();
+  requestSalelist();
 }
 
 defineExpose({
   onDisplay: (_list: Array<Record<string, string>>) => {
     visible.value = true;
-    reuquestSalelist();
+    requestSalelist();
   }
 });
 
 //初始化订单列表
-onMounted(() => reuquestSalelist());
+onMounted(() => requestSalelist());
 </script>
 
 <template>
-  <el-dialog
+  <ElDialog
     :close-on-click-modal="false"
     :close-on-press-escape="false"
+    @close="() => (selectSaleOrder = [])"
     v-model="visible"
-    title="销售订单"
     width="1040px"
-    @close="() => (selectSaleOrder = [])"
+    :title="title"
     top="10px"
     center
   >
-    <el-row :gutter="10" style="margin-bottom: 10px">
-      <el-col :span="8">
+    <ElRow :gutter="10" style="margin-bottom: 10px">
+      <ElCol :span="8">
         <date-range size="small" v-model="data.timer" />
-      </el-col>
+      </ElCol>
 
-      <el-col :span="8">
-        <el-input
-          v-model="data.sequenceNo"
-          placeholder="订单编码"
-          size="small"
-        />
-      </el-col>
+      <ElCol :span="8">
+        <ElInput v-model="data.sequenceNo" placeholder="订单编码" size="small" />
+      </ElCol>
 
-      <el-col :span="8">
-        <el-select
-          class="w-full"
+      <ElCol :span="8">
+        <ElSelect
           size="small"
-          clearable
+          class="w-full"
           v-model="data.qrdsource"
           placeholder="订单来源"
+          clearable
         >
-          <el-option
-            v-for="type in xs_order_source_options"
-            :key="type.value"
-            v-bind="type"
+          <ElOption
+            v-for="opt in xs_order_source_options"
+            :key="opt.value"
+            v-bind="opt"
           />
-        </el-select>
-      </el-col>
-    </el-row>
+        </ElSelect>
+      </ElCol>
+    </ElRow>
 
-    <el-row :gutter="10" style="margin-bottom: 10px">
+    <ElRow :gutter="10" style="margin-bottom: 10px">
       <el-col :span="8">
         <el-select
           class="w-full"
@@ -173,7 +175,7 @@ onMounted(() => reuquestSalelist());
       <el-col :span="8">
         <el-input placeholder="平台名称" size="small" v-model="data.platName" />
       </el-col>
-    </el-row>
+    </ElRow>
 
     <el-row :gutter="10">
       <el-col :span="8">
@@ -193,26 +195,11 @@ onMounted(() => reuquestSalelist());
           active-value="2"
           inactive-value="1"
         />
-        <!-- <el-select
-          v-model="data.platform_type"
-          size="small"
-          placeholder="平台类型"
-          style="width: 100%"
-        >
-          <el-option
-            v-for="opt in useTypeOptions"
-            :value="opt.value"
-            :label="opt.label"
-            :key="opt.value"
-          />
-        </el-select> -->
       </el-col>
     </el-row>
 
     <div flex gap-2 justify-end mb-1>
-      <el-button size="small" type="primary" @click="() => search()"
-        >搜索</el-button
-      >
+      <el-button size="small" type="primary" @click="() => search()">搜索</el-button>
       <el-button size="small" @click="() => search(true)">重置</el-button>
     </div>
 
@@ -276,7 +263,7 @@ onMounted(() => reuquestSalelist());
         :page-sizes="[15, 50, 100]"
         @size-change="handleSizeChange"
         layout="sizes, prev, pager, next"
-        @current-change="reuquestSalelist"
+        @current-change="requestSalelist"
         size="small"
       />
 
@@ -289,5 +276,5 @@ onMounted(() => reuquestSalelist());
         >
       </div>
     </div>
-  </el-dialog>
+  </ElDialog>
 </template>

+ 11 - 2
src/views/InvoiceSales/capitalPool/detail.vue

@@ -27,8 +27,17 @@ const { hasPermissionWithCode } = usePermission(pageName);
 const tradeNo = computed(() => capitalDetail.value?.tradNo);
 
 
-const { data: capitalDetail, run: capitalDetailRun, loading } = useAsync<Record<string, string>>({ initialData: {} });
-const { data: tradeDetail, run: tradeDetailRun } = useAsync<Record<string, string>>({ initialData: {} });
+const { 
+  run: capitalDetailRun, 
+  data: capitalDetail, 
+  loading 
+} = useAsync<Record<string, string>>({ initialData: {} });
+
+
+const {
+  run: tradeDetailRun,
+  data: tradeDetail
+} = useAsync<Record<string, string>>({ initialData: {} });
 
 
 const { run: capitalStatusRun } = useAsync({ success: () => { requestCapitalDetail(); } });

+ 10 - 3
src/views/InvoiceSales/invoiceApply/components/currentcy-form/add-edit-form.vue

@@ -139,6 +139,15 @@ function handleSave() {
        }
     }
 
+    console.log({
+      relaComNo: ruleForm.value.companyNo,
+      ...ruleForm.value,
+      ...generatorOrderArr(),
+      is_comon:'1'
+    })
+
+    return
+
     const { code, message } = await httpAdd({
       relaComNo: ruleForm.value.companyNo,
       ...ruleForm.value,
@@ -218,9 +227,7 @@ const setPurchaserInvoiceTitle = handleInvoiceTitle.bind(null, false);
 
 async function handleCompanyChange(companyNo) {
   ruleForm.value.companyNo = companyNo;
-  const { code, data, message } = await httpCompanylist({
-    companyNo
-  });
+  const { code, data, message } = await httpCompanylist({ companyNo });
 
   nextTick(() => {
     if (formRef.value) {

+ 1 - 0
src/views/InvoiceSales/sheetOrderPool/index.vue

@@ -34,6 +34,7 @@ async function onDownloadOpenInv() {
     ElMessage.error("请选择订单数据!");
     return;
   }
+
   let arr = [];
   selects.value.forEach(si => {
     let model = JSON.parse(JSON.stringify(si));