|
@@ -179,7 +179,7 @@ import {
|
|
|
import { UploadFilled } from '@element-plus/icons-vue'
|
|
|
import * as XLSX from 'xlsx'
|
|
|
import type { FormInstance, FormRules } from 'element-plus'
|
|
|
-import { IPoItem, IOptionItem, IPoItem2 } from '../inteface'
|
|
|
+import { IPoItem, IOptionItem } from '../inteface'
|
|
|
// import request from '@/utils/axios'
|
|
|
import utils from '@/utils/index'
|
|
|
|
|
@@ -333,41 +333,11 @@ const next = (formEl: FormInstance | undefined) => {
|
|
|
fileReader.onload = (e: any) => {
|
|
|
const data = XLSX.read(e.target.result, { type: 'binary' })
|
|
|
// 重命名列名
|
|
|
- if (form.value.paymentType === '货款') {
|
|
|
- data.Sheets[data.SheetNames[0]].A1.w = 'po_number'
|
|
|
- data.Sheets[data.SheetNames[0]].B1.w = 'sku'
|
|
|
- data.Sheets[data.SheetNames[0]].C1.w = 'description'
|
|
|
- data.Sheets[data.SheetNames[0]].D1.w = 'unit_price'
|
|
|
- data.Sheets[data.SheetNames[0]].E1.w = 'quantity'
|
|
|
- data.Sheets[data.SheetNames[0]].F1.w = 'sample_fee'
|
|
|
- data.Sheets[data.SheetNames[0]].G1.w = 'setup_service_fee'
|
|
|
- data.Sheets[data.SheetNames[0]].H1.w = 'total'
|
|
|
-
|
|
|
- const jsonData = XLSX.utils.sheet_to_json(
|
|
|
- data.Sheets[data.SheetNames[0]],
|
|
|
- ) as IPoItem[]
|
|
|
- jsonData.forEach((i) => {
|
|
|
- i.unit_price = utils.toFixed(Number(i.unit_price || 0), 1000)
|
|
|
- i.quantity = utils.toFixed(Number(i.quantity || 0), 1000)
|
|
|
- i.sample_fee = utils.toFixed(Number(i.sample_fee || 0), 1000)
|
|
|
- i.setup_service_fee = utils.toFixed(
|
|
|
- Number(i.setup_service_fee || 0),
|
|
|
- 1000,
|
|
|
- )
|
|
|
- i.total = utils.toFixed(Number(i.total || 0), 1000)
|
|
|
- tableData.value.push({
|
|
|
- ...i,
|
|
|
- po_number: i.po_number.toUpperCase(),
|
|
|
- payment_type: form.value.paymentType,
|
|
|
- statement_name: form.value.statement_name,
|
|
|
- currency: form.value.currency,
|
|
|
- })
|
|
|
- })
|
|
|
- } else if (form.value.paymentType === '国内运费') {
|
|
|
+ if (form.value.paymentType === '国内运费') {
|
|
|
// todo
|
|
|
const jsonData = XLSX.utils.sheet_to_json(
|
|
|
data.Sheets[data.SheetNames[0]],
|
|
|
- ) as IPoItem2[]
|
|
|
+ ) as IPoItem[]
|
|
|
jsonData.forEach((i) => {
|
|
|
tableData.value.push({
|
|
|
...i,
|