Переглянути джерело

change: payment request 国内运费 处理issue data数据.

peter 4 місяців тому
батько
коміт
bf0a9f9de7

+ 12 - 2
src/pages/payment-record2/components/upload.vue

@@ -181,7 +181,7 @@ import * as XLSX from 'xlsx'
 import type { FormInstance, FormRules } from 'element-plus'
 import { IPoItem, IOptionItem } from '../inteface'
 // import request from '@/utils/axios'
-import utils from '@/utils/index'
+import dayjs from 'dayjs'
 
 const props = defineProps({
   visible: {
@@ -331,16 +331,26 @@ const next = (formEl: FormInstance | undefined) => {
         const fileReader = new FileReader()
 
         fileReader.onload = (e: any) => {
-          const data = XLSX.read(e.target.result, { type: 'binary' })
+          const data = XLSX.read(e.target.result, {
+            type: 'binary',
+            cellDates: true,
+          })
           // 重命名列名
           if (form.value.paymentType === '国内运费') {
             // todo
             const jsonData = XLSX.utils.sheet_to_json(
               data.Sheets[data.SheetNames[0]],
+              {
+                dateNF: 'yyyy-mm',
+              },
             ) as IPoItem[]
             jsonData.forEach((i) => {
+              console.log(i.Issue_Date, 'date')
               tableData.value.push({
                 ...i,
+                Issue_Date: dayjs(
+                  new Date(i.Issue_Date).getTime() + 43000,
+                ).format('YYYY-MM-DD'),
                 Weight_Unit: form.value.weightUnit,
                 Currency: form.value.currency,
                 payment_type: form.value.paymentType,

+ 1 - 2
src/pages/payment-record2/inteface.ts

@@ -1,4 +1,3 @@
-
 export interface IPoItem {
   PO_Number: string
   PO_Number2: string
@@ -8,7 +7,7 @@ export interface IPoItem {
   ATTN: string
   From_Address: string
   To_Address: string
-  Issue_Date: string
+  Issue_Date: string | Date
   Weight: number
   Volume: number
   Billable_Weight: number