|
@@ -16,6 +16,7 @@
|
|
element-loading-background="rgba(0, 0, 0, 0.3)"
|
|
element-loading-background="rgba(0, 0, 0, 0.3)"
|
|
></div>
|
|
></div>
|
|
<div class="main-content">
|
|
<div class="main-content">
|
|
|
|
+ <navPaymentRecord></navPaymentRecord>
|
|
<div class="flex between">
|
|
<div class="flex between">
|
|
<div class="flex btn-wrap">
|
|
<div class="flex btn-wrap">
|
|
<el-button
|
|
<el-button
|
|
@@ -26,22 +27,7 @@
|
|
Delete
|
|
Delete
|
|
</el-button>
|
|
</el-button>
|
|
|
|
|
|
- <el-dropdown
|
|
|
|
- trigger="hover"
|
|
|
|
- style="margin: 0 12px"
|
|
|
|
- >
|
|
|
|
- <el-button>Download XLSX sample</el-button>
|
|
|
|
- <template #dropdown>
|
|
|
|
- <el-dropdown-menu>
|
|
|
|
- <el-dropdown-item @click="downloadSample">
|
|
|
|
- 货款模板
|
|
|
|
- </el-dropdown-item>
|
|
|
|
- <el-dropdown-item @click="downloadSample2">
|
|
|
|
- 国内运费模板
|
|
|
|
- </el-dropdown-item>
|
|
|
|
- </el-dropdown-menu>
|
|
|
|
- </template>
|
|
|
|
- </el-dropdown>
|
|
|
|
|
|
+ <el-button @click="downloadSample">Download XLSX sample</el-button>
|
|
|
|
|
|
<el-button
|
|
<el-button
|
|
type="primary"
|
|
type="primary"
|
|
@@ -186,186 +172,14 @@
|
|
</div>
|
|
</div>
|
|
<div class="flex">
|
|
<div class="flex">
|
|
<div class="">Currency:</div>
|
|
<div class="">Currency:</div>
|
|
- <div v-if="tableData.length">
|
|
|
|
- {{ tableData[0].currency || 'a' }}
|
|
|
|
|
|
+ <div>
|
|
|
|
+ {{ tableData[0]?.currency || '0' }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <div
|
|
|
|
- v-else
|
|
|
|
- class="po-table"
|
|
|
|
- >
|
|
|
|
- <el-table
|
|
|
|
- :data="computedTableData2"
|
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
|
- >
|
|
|
|
- <el-table-column
|
|
|
|
- fixed
|
|
|
|
- type="selection"
|
|
|
|
- width="55"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="payment_type"
|
|
|
|
- label="Payment Type"
|
|
|
|
- width="120"
|
|
|
|
- align="center"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="statement_name"
|
|
|
|
- label="Statement Name"
|
|
|
|
- min-width="150"
|
|
|
|
- align="center"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="po_number"
|
|
|
|
- label="PO Number"
|
|
|
|
- align="center"
|
|
|
|
- width="200"
|
|
|
|
- label-class-name="red-font"
|
|
|
|
- >
|
|
|
|
- <template #default="scope">
|
|
|
|
- {{
|
|
|
|
- [
|
|
|
|
- scope.row.PO_Number,
|
|
|
|
- scope.row.PO_Number2,
|
|
|
|
- scope.row.PO_Number3,
|
|
|
|
- ]
|
|
|
|
- .filter((i) => !!i)
|
|
|
|
- .join('; ')
|
|
|
|
- }}
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column
|
|
|
|
- prop="Total"
|
|
|
|
- label="Total"
|
|
|
|
- align="center"
|
|
|
|
- width="110"
|
|
|
|
- label-class-name="red-font"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="Billable_Weight"
|
|
|
|
- label="Billable Weight"
|
|
|
|
- align="center"
|
|
|
|
- width="150"
|
|
|
|
- label-class-name="red-font"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="Tracking_Number"
|
|
|
|
- label="Tracking Number"
|
|
|
|
- align="center"
|
|
|
|
- width="150"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="Sender"
|
|
|
|
- label="Sender"
|
|
|
|
- align="center"
|
|
|
|
- width="110"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="ATTN"
|
|
|
|
- label="ATTN"
|
|
|
|
- align="center"
|
|
|
|
- width="110"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="From_Address"
|
|
|
|
- label="From Address"
|
|
|
|
- align="center"
|
|
|
|
- width="150"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="To_Address"
|
|
|
|
- label="To Address"
|
|
|
|
- align="center"
|
|
|
|
- width="150"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="Issue_Date"
|
|
|
|
- label="Issue Date"
|
|
|
|
- align="center"
|
|
|
|
- width="110"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="Weight"
|
|
|
|
- label="Weight"
|
|
|
|
- align="center"
|
|
|
|
- width="110"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="Volume"
|
|
|
|
- label="Volume"
|
|
|
|
- align="center"
|
|
|
|
- width="110"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="Fee_Type"
|
|
|
|
- label="Fee Type (运费/保费 etc...)"
|
|
|
|
- align="center"
|
|
|
|
- width="150"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="Package_Type"
|
|
|
|
- label="Package Type (次日达/顺丰特快 etc...)"
|
|
|
|
- align="center"
|
|
|
|
- width="180"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="Director"
|
|
|
|
- label="Director"
|
|
|
|
- align="center"
|
|
|
|
- width="110"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- fixed="right"
|
|
|
|
- label="Action"
|
|
|
|
- width="80px"
|
|
|
|
- >
|
|
|
|
- <template #default="scope">
|
|
|
|
- <el-button
|
|
|
|
- size="small"
|
|
|
|
- type="warning"
|
|
|
|
- @click="editRow(scope.row, scope.$index)"
|
|
|
|
- >
|
|
|
|
- Edit
|
|
|
|
- </el-button>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
- <br />
|
|
|
|
- <div
|
|
|
|
- class="flex between"
|
|
|
|
- style="align-items: flex-end"
|
|
|
|
- >
|
|
|
|
- <el-pagination
|
|
|
|
- v-model:currentPage="currentPage"
|
|
|
|
- v-model:pageSize="pageSize"
|
|
|
|
- layout="prev, pager, next, jumper, sizes"
|
|
|
|
- :page-sizes="[5, 10, 15, 20, 40, 100]"
|
|
|
|
- :total="tableData2.length"
|
|
|
|
- @current-change="multipleSelection = []"
|
|
|
|
- @size-change="multipleSelection = []"
|
|
|
|
- />
|
|
|
|
- <div class="total-data">
|
|
|
|
- <div class="flex">
|
|
|
|
- <div>Total line:</div>
|
|
|
|
- <div>{{ tableData2.length }}</div>
|
|
|
|
- </div>
|
|
|
|
- <div class="flex">
|
|
|
|
- <div class="">Sum Total:</div>
|
|
|
|
- <div class="">{{ computedSum2 }}</div>
|
|
|
|
- </div>
|
|
|
|
- <div class="flex">
|
|
|
|
- <div class="">Currency:</div>
|
|
|
|
- <div v-if="tableData2.length">
|
|
|
|
- {{ tableData2[0].Currency || 'b' }}
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
<div class="copyright">
|
|
<div class="copyright">
|
|
Copyright of Promocollection - Version 1.02 Released on 30/07/2024
|
|
Copyright of Promocollection - Version 1.02 Released on 30/07/2024
|
|
</div>
|
|
</div>
|
|
@@ -373,7 +187,6 @@
|
|
<dialog-upload
|
|
<dialog-upload
|
|
v-model:visible="dialogVisible"
|
|
v-model:visible="dialogVisible"
|
|
v-model:currencyList="currencyList"
|
|
v-model:currencyList="currencyList"
|
|
- v-model:defaultFileType="defaultFileType"
|
|
|
|
@update-table-data="updateTableData"
|
|
@update-table-data="updateTableData"
|
|
></dialog-upload>
|
|
></dialog-upload>
|
|
<edit-item
|
|
<edit-item
|
|
@@ -387,17 +200,6 @@
|
|
@edit="onEditRow"
|
|
@edit="onEditRow"
|
|
@add="onAddRow"
|
|
@add="onAddRow"
|
|
></edit-item>
|
|
></edit-item>
|
|
- <edit-item2
|
|
|
|
- v-model:visible="dialogEditRowVisible2"
|
|
|
|
- v-model:currencyList="currencyList"
|
|
|
|
- v-model:currentEditRow="computedCurrentEditRow2"
|
|
|
|
- v-model:editMode="editMode"
|
|
|
|
- v-model:disableFlag="currentDisableFlag"
|
|
|
|
- :statement-list="computedStatementList"
|
|
|
|
- :locked-currency="tableData2.length ? tableData2[0].Currency : 'CNY'"
|
|
|
|
- @edit="onEditRow"
|
|
|
|
- @add="onAddRow"
|
|
|
|
- ></edit-item2>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
@@ -410,9 +212,6 @@ export default defineComponent({
|
|
import { defineComponent, ref, computed } from 'vue'
|
|
import { defineComponent, ref, computed } from 'vue'
|
|
import {
|
|
import {
|
|
ElButton,
|
|
ElButton,
|
|
- ElDropdown,
|
|
|
|
- ElDropdownMenu,
|
|
|
|
- ElDropdownItem,
|
|
|
|
ElTable,
|
|
ElTable,
|
|
ElTableColumn,
|
|
ElTableColumn,
|
|
ElPagination,
|
|
ElPagination,
|
|
@@ -422,12 +221,13 @@ import {
|
|
import { useRoute } from 'vue-router'
|
|
import { useRoute } from 'vue-router'
|
|
import dialogUpload from './components/upload.vue'
|
|
import dialogUpload from './components/upload.vue'
|
|
import editItem from './components/edit.vue'
|
|
import editItem from './components/edit.vue'
|
|
-import editItem2 from './components/edit2.vue'
|
|
|
|
|
|
+
|
|
import { IUser } from '@/interface'
|
|
import { IUser } from '@/interface'
|
|
import { IPoItem, IPoItem2 } from './inteface'
|
|
import { IPoItem, IPoItem2 } from './inteface'
|
|
import request from '@/utils/axios'
|
|
import request from '@/utils/axios'
|
|
import utils from '@/utils/index'
|
|
import utils from '@/utils/index'
|
|
import * as XLSX from 'xlsx'
|
|
import * as XLSX from 'xlsx'
|
|
|
|
+import navPaymentRecord from './components/nav.vue'
|
|
|
|
|
|
const loading = ref(false)
|
|
const loading = ref(false)
|
|
|
|
|
|
@@ -446,10 +246,6 @@ const onDelete = function () {
|
|
tableData.value = tableData.value.filter((i) => {
|
|
tableData.value = tableData.value.filter((i) => {
|
|
return !target.includes(i)
|
|
return !target.includes(i)
|
|
})
|
|
})
|
|
- } else if (tableData2.value.length) {
|
|
|
|
- tableData2.value = tableData2.value.filter((i) => {
|
|
|
|
- return !target.includes(i)
|
|
|
|
- })
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -467,7 +263,6 @@ const sheetData = [
|
|
},
|
|
},
|
|
]
|
|
]
|
|
|
|
|
|
-const defaultFileType = ref('货款')
|
|
|
|
const downloadSample = function () {
|
|
const downloadSample = function () {
|
|
const sheet1 = XLSX.utils.json_to_sheet(sheetData)
|
|
const sheet1 = XLSX.utils.json_to_sheet(sheetData)
|
|
const wb = XLSX.utils.book_new()
|
|
const wb = XLSX.utils.book_new()
|
|
@@ -484,54 +279,6 @@ const downloadSample = function () {
|
|
XLSX.utils.book_append_sheet(wb, sheet1, 'sheet1')
|
|
XLSX.utils.book_append_sheet(wb, sheet1, 'sheet1')
|
|
|
|
|
|
XLSX.writeFile(wb, '货款模版.xlsx')
|
|
XLSX.writeFile(wb, '货款模版.xlsx')
|
|
- defaultFileType.value = '货款'
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const sheetData2 = [
|
|
|
|
- {
|
|
|
|
- PO_Number: '',
|
|
|
|
- PO_Number2: '',
|
|
|
|
- PO_Number3: '',
|
|
|
|
- Total: '',
|
|
|
|
- Billable_Weight: '',
|
|
|
|
- Tracking_Number: '',
|
|
|
|
- Sender: '',
|
|
|
|
- ATTN: '',
|
|
|
|
- From_Address: '',
|
|
|
|
- To_Address: '',
|
|
|
|
- Issue_Date: '',
|
|
|
|
- Weight: '',
|
|
|
|
- Volume: '',
|
|
|
|
- Fee_Type: '',
|
|
|
|
- Package_Type: '',
|
|
|
|
- Director: '',
|
|
|
|
- },
|
|
|
|
-]
|
|
|
|
-const downloadSample2 = function () {
|
|
|
|
- const sheet1 = XLSX.utils.json_to_sheet(sheetData2)
|
|
|
|
- const wb = XLSX.utils.book_new()
|
|
|
|
- sheet1['!cols'] = [
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 150 },
|
|
|
|
- { wpx: 150 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- { wpx: 100 },
|
|
|
|
- ]
|
|
|
|
- XLSX.utils.book_append_sheet(wb, sheet1, 'sheet1')
|
|
|
|
-
|
|
|
|
- XLSX.writeFile(wb, '国内运费模版.xlsx')
|
|
|
|
- defaultFileType.value = '国内运费'
|
|
|
|
}
|
|
}
|
|
|
|
|
|
const tableData = ref([] as IPoItem[])
|
|
const tableData = ref([] as IPoItem[])
|
|
@@ -544,15 +291,6 @@ const computedSum = computed(() => {
|
|
1000,
|
|
1000,
|
|
)
|
|
)
|
|
})
|
|
})
|
|
-const computedSum2 = computed(() => {
|
|
|
|
- return utils.toFixed(
|
|
|
|
- tableData2.value.reduce((total, current) => {
|
|
|
|
- total = total + Number(current.Total)
|
|
|
|
- return total
|
|
|
|
- }, 0),
|
|
|
|
- 1000,
|
|
|
|
- )
|
|
|
|
-})
|
|
|
|
|
|
|
|
const tableData2 = ref([
|
|
const tableData2 = ref([
|
|
// Object.assign(
|
|
// Object.assign(
|
|
@@ -589,20 +327,13 @@ const updateTableData = (
|
|
p: { data: IPoItem[] | IPoItem2[]; mode: string },
|
|
p: { data: IPoItem[] | IPoItem2[]; mode: string },
|
|
file: any,
|
|
file: any,
|
|
) => {
|
|
) => {
|
|
- // console.log(p, 'p')
|
|
|
|
- if (typeof p.data[0].ATTN !== 'undefined') {
|
|
|
|
- tableData2.value = p.data as IPoItem2[]
|
|
|
|
- tableData.value = []
|
|
|
|
- } else {
|
|
|
|
- tableData.value = p.data as IPoItem[]
|
|
|
|
- tableData2.value = []
|
|
|
|
- }
|
|
|
|
|
|
+ tableData.value = p.data as IPoItem[]
|
|
currentPage.value = 1
|
|
currentPage.value = 1
|
|
fileContainer.value = file
|
|
fileContainer.value = file
|
|
}
|
|
}
|
|
|
|
|
|
const currentDisableFlag = computed(() => {
|
|
const currentDisableFlag = computed(() => {
|
|
- return tableData.value.length > 0 || tableData2.value.length > 0
|
|
|
|
|
|
+ return tableData.value.length > 0
|
|
})
|
|
})
|
|
|
|
|
|
const currentPage = ref(1)
|
|
const currentPage = ref(1)
|
|
@@ -618,16 +349,6 @@ const computedTableData = computed(() => {
|
|
: tableData.value.length,
|
|
: tableData.value.length,
|
|
)
|
|
)
|
|
})
|
|
})
|
|
-const computedTableData2 = computed(() => {
|
|
|
|
- return tableData2.value.length < pageSize.value
|
|
|
|
- ? tableData2.value
|
|
|
|
- : tableData2.value.slice(
|
|
|
|
- (currentPage.value - 1) * pageSize.value,
|
|
|
|
- tableData2.value.length > currentPage.value * pageSize.value
|
|
|
|
- ? currentPage.value * pageSize.value
|
|
|
|
- : tableData2.value.length,
|
|
|
|
- )
|
|
|
|
-})
|
|
|
|
const computedStatementList = computed(() => {
|
|
const computedStatementList = computed(() => {
|
|
const result: any[] = []
|
|
const result: any[] = []
|
|
|
|
|
|
@@ -637,12 +358,6 @@ const computedStatementList = computed(() => {
|
|
result.push(i.statement_name)
|
|
result.push(i.statement_name)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- } else {
|
|
|
|
- tableData2.value.forEach((i) => {
|
|
|
|
- if (i.statement_name?.length && !result.includes(i.statement_name)) {
|
|
|
|
- result.push(i.statement_name)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
}
|
|
}
|
|
return result.map((i, index) => {
|
|
return result.map((i, index) => {
|
|
// statement调整成点击保存再创建了, 而不是之前的在上传对话框创建, 所以逻辑变动, 这里拿不到id, 只能拿name凑合.
|
|
// statement调整成点击保存再创建了, 而不是之前的在上传对话框创建, 所以逻辑变动, 这里拿不到id, 只能拿name凑合.
|
|
@@ -653,7 +368,6 @@ const computedStatementList = computed(() => {
|
|
})
|
|
})
|
|
})
|
|
})
|
|
const dialogEditRowVisible = ref(false)
|
|
const dialogEditRowVisible = ref(false)
|
|
-const dialogEditRowVisible2 = ref(false)
|
|
|
|
const currentEditIndex = ref(-1) // -1新增, 其余则为当前页的行号
|
|
const currentEditIndex = ref(-1) // -1新增, 其余则为当前页的行号
|
|
const editMode = ref(1) // 1新增 2编辑
|
|
const editMode = ref(1) // 1新增 2编辑
|
|
|
|
|
|
@@ -665,26 +379,13 @@ const computedCurrentEditRow = computed(() => {
|
|
}
|
|
}
|
|
return {}
|
|
return {}
|
|
})
|
|
})
|
|
-const computedCurrentEditRow2 = computed(() => {
|
|
|
|
- if (currentEditIndex.value > -1) {
|
|
|
|
- return tableData2.value[
|
|
|
|
- (currentPage.value - 1) * pageSize.value + currentEditIndex.value
|
|
|
|
- ]
|
|
|
|
- }
|
|
|
|
- return {}
|
|
|
|
-})
|
|
|
|
|
|
+
|
|
const addRow = function () {
|
|
const addRow = function () {
|
|
- // 判断要编辑哪个表
|
|
|
|
if (tableData.value.length) {
|
|
if (tableData.value.length) {
|
|
// console.log('货款')
|
|
// console.log('货款')
|
|
editMode.value = 1
|
|
editMode.value = 1
|
|
currentEditIndex.value = -1
|
|
currentEditIndex.value = -1
|
|
dialogEditRowVisible.value = true
|
|
dialogEditRowVisible.value = true
|
|
- } else if (tableData2.value.length) {
|
|
|
|
- // console.log('国内快递')
|
|
|
|
- editMode.value = 1
|
|
|
|
- currentEditIndex.value = -1
|
|
|
|
- dialogEditRowVisible2.value = true
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -693,8 +394,6 @@ const editRow = function (row: IPoItem, index: number) {
|
|
currentEditIndex.value = index
|
|
currentEditIndex.value = index
|
|
if (tableData.value.length) {
|
|
if (tableData.value.length) {
|
|
dialogEditRowVisible.value = true
|
|
dialogEditRowVisible.value = true
|
|
- } else {
|
|
|
|
- dialogEditRowVisible2.value = true
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -702,9 +401,6 @@ const onAddRow = function (data: IPoItem | IPoItem2) {
|
|
if (tableData.value.length) {
|
|
if (tableData.value.length) {
|
|
tableData.value.push(data as IPoItem)
|
|
tableData.value.push(data as IPoItem)
|
|
dialogEditRowVisible.value = false
|
|
dialogEditRowVisible.value = false
|
|
- } else {
|
|
|
|
- tableData2.value.push(data as IPoItem2)
|
|
|
|
- dialogEditRowVisible2.value = false
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const onEditRow = function (data: IPoItem | IPoItem2) {
|
|
const onEditRow = function (data: IPoItem | IPoItem2) {
|
|
@@ -715,13 +411,6 @@ const onEditRow = function (data: IPoItem | IPoItem2) {
|
|
1,
|
|
1,
|
|
data as IPoItem,
|
|
data as IPoItem,
|
|
)
|
|
)
|
|
- } else {
|
|
|
|
- dialogEditRowVisible2.value = false
|
|
|
|
- tableData2.value.splice(
|
|
|
|
- (currentPage.value - 1) * pageSize.value + currentEditIndex.value,
|
|
|
|
- 1,
|
|
|
|
- data as IPoItem2,
|
|
|
|
- )
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const tryCreateStatement = function () {
|
|
const tryCreateStatement = function () {
|
|
@@ -735,8 +424,6 @@ const tryCreateStatement = function () {
|
|
}
|
|
}
|
|
if (tableData.value.length) {
|
|
if (tableData.value.length) {
|
|
createStatement()
|
|
createStatement()
|
|
- } else {
|
|
|
|
- createStatement2()
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const statementID = ref('')
|
|
const statementID = ref('')
|
|
@@ -913,378 +600,6 @@ const send = (
|
|
})
|
|
})
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-// 带后缀2的全部是国内运费的相关处理逻辑. 因为两个模式相同和不相同的逻辑基本参半, 干脆直接揉在一起写了
|
|
|
|
-const createStatement2 = function () {
|
|
|
|
- loading.value = true
|
|
|
|
- request
|
|
|
|
- .post('/payment_request/createStatementData', [
|
|
|
|
- {
|
|
|
|
- Total_Amount: computedSum2.value,
|
|
|
|
- Currency: tableData2.value[0].currency,
|
|
|
|
- Name: tableData2.value[0].statement_name,
|
|
|
|
- Owner: {
|
|
|
|
- name: userInfo.value.full_name,
|
|
|
|
- id: userInfo.value.id,
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- ])
|
|
|
|
- .then((response) => {
|
|
|
|
- if (response.data.code !== 1) {
|
|
|
|
- ElMessage.error('创建statement出错')
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- statementID.value = response.data.result.data[0].details.id
|
|
|
|
-
|
|
|
|
- splitPaymentRequestRecordForm2() // 重写splitForm, 参数几乎完全不同
|
|
|
|
- uploadStatementFile() // 这步操作直接解开注释就行. 逻辑参数通用
|
|
|
|
- })
|
|
|
|
- .catch(() => {
|
|
|
|
- loading.value = false
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-const splitPaymentRequestRecordForm2 = function () {
|
|
|
|
- const formData = tableData2.value.reduce((t, i) => {
|
|
|
|
- const temp: any = {
|
|
|
|
- Tracking_Number: i.Tracking_Number,
|
|
|
|
- Unit_Price: 0,
|
|
|
|
- Quantity: '',
|
|
|
|
- Sample_Fee: 0,
|
|
|
|
- Setup_Service_Fee: 0,
|
|
|
|
- Total: i.Total || 0,
|
|
|
|
- Currency: i.Currency,
|
|
|
|
- Description: '',
|
|
|
|
- SKU: '',
|
|
|
|
- Unit_Price_Non_Currency: '',
|
|
|
|
- Payment_Type: i.payment_type,
|
|
|
|
- Statement: { name: i.statement_name, id: statementID.value },
|
|
|
|
- Request_Type: '月结申请',
|
|
|
|
- Name: '/',
|
|
|
|
- Owner: {
|
|
|
|
- name: userInfo.value.full_name,
|
|
|
|
- id: userInfo.value.id,
|
|
|
|
- },
|
|
|
|
- Payment_Status: 'Pending Verify',
|
|
|
|
- Batch_number: new Date().getTime().toString(),
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (i.PO_Number) {
|
|
|
|
- t.push(Object.assign({ PO_id: i.PO_Number }, temp))
|
|
|
|
- }
|
|
|
|
- if (i.PO_Number2) {
|
|
|
|
- t.push(Object.assign({ PO_id: i.PO_Number2 }, temp))
|
|
|
|
- }
|
|
|
|
- if (i.PO_Number3) {
|
|
|
|
- t.push(Object.assign({ PO_id: i.PO_Number3 }, temp))
|
|
|
|
- }
|
|
|
|
- return t
|
|
|
|
- }, [] as any[])
|
|
|
|
- // console.log(formData, 'form data 2')
|
|
|
|
- let size = 100
|
|
|
|
- const dataList = utils.splitArray(formData, size)
|
|
|
|
- const pool = []
|
|
|
|
- for (let i = 0; i < dataList.length; i++) {
|
|
|
|
- pool.push(
|
|
|
|
- createPaymentRequestRecord2(
|
|
|
|
- dataList[i],
|
|
|
|
- i,
|
|
|
|
- size,
|
|
|
|
- i === dataList.length - 1 ? formData.length : 0,
|
|
|
|
- ),
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
- loading.value = true
|
|
|
|
- Promise.all(pool).finally(() => {
|
|
|
|
- splitDomesticTracking2()
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const createPaymentRequestRecord2 = function (
|
|
|
|
- data: any[],
|
|
|
|
- currentPage = 0,
|
|
|
|
- pageSize = 1,
|
|
|
|
- finalValue: number,
|
|
|
|
-) {
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
- request
|
|
|
|
- .post('/payment_request/createPaymentRequestRecord', data)
|
|
|
|
- .then((response) => {
|
|
|
|
- if (response.data.code !== 1) {
|
|
|
|
- ElNotification({
|
|
|
|
- type: 'error',
|
|
|
|
- duration: 0,
|
|
|
|
- title: '创建异常',
|
|
|
|
- message: `第 ${currentPage * pageSize + 1} ~ ${
|
|
|
|
- finalValue || (currentPage + 1) * pageSize
|
|
|
|
- } 行数据创建异常`,
|
|
|
|
- })
|
|
|
|
- reject(0)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- const res = response.data.result
|
|
|
|
- if (Array.isArray(res.data)) {
|
|
|
|
- const temp = res.data.map((i: any, index: number) => {
|
|
|
|
- return {
|
|
|
|
- status: i.status,
|
|
|
|
- index,
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- const temp2 = temp.filter((i: any) => i.status !== 'success')
|
|
|
|
-
|
|
|
|
- if (temp2.length) {
|
|
|
|
- ElNotification({
|
|
|
|
- type: 'error',
|
|
|
|
- duration: 0,
|
|
|
|
- title: '创建异常',
|
|
|
|
- message: `第 ${temp2
|
|
|
|
- .map((i: any) => i.index + 1 + currentPage * pageSize)
|
|
|
|
- .join(',')} 行数据创建异常`,
|
|
|
|
- })
|
|
|
|
- reject(0)
|
|
|
|
- } else {
|
|
|
|
- ElNotification({
|
|
|
|
- duration: 0,
|
|
|
|
- title: '创建成功',
|
|
|
|
- type: 'success',
|
|
|
|
- message: `第 ${currentPage * pageSize + 1} ~ ${
|
|
|
|
- finalValue || (currentPage + 1) * pageSize
|
|
|
|
- } 行数据创建成功`,
|
|
|
|
- })
|
|
|
|
- resolve(1)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const splitDomesticTracking2 = function () {
|
|
|
|
- const formData = tableData2.value.reduce((t, i, index) => {
|
|
|
|
- const temp: any = {
|
|
|
|
- ...i,
|
|
|
|
- Billable_Weight: i.Billable_Weight || 0,
|
|
|
|
- Total: i.Total || 0,
|
|
|
|
- Weight: i.Weight || 0,
|
|
|
|
- Volume: i.Volume || 0,
|
|
|
|
- Statement: { name: i.statement_name, id: statementID.value },
|
|
|
|
- Name: `${i.Issue_Date} - ${i.Tracking_Number}`,
|
|
|
|
- From: i.From_Address,
|
|
|
|
- To: i.To_Address,
|
|
|
|
- Amount: i.Total,
|
|
|
|
- Weight_Unit: i.Weight_Unit,
|
|
|
|
- Owner: {
|
|
|
|
- name: userInfo.value.full_name,
|
|
|
|
- id: userInfo.value.id,
|
|
|
|
- },
|
|
|
|
- }
|
|
|
|
- // 删除不必要的参数字段. 以下几个数据有其他表示的名称
|
|
|
|
- delete temp.PO_Number
|
|
|
|
- delete temp.PO_Number2
|
|
|
|
- delete temp.PO_Number3
|
|
|
|
- delete temp.statement_name
|
|
|
|
- delete temp.payment_type
|
|
|
|
- delete temp.From_Address
|
|
|
|
- delete temp.To_Address
|
|
|
|
- delete temp.Total
|
|
|
|
-
|
|
|
|
- if (i.PO_Number) {
|
|
|
|
- t.push(Object.assign({ PO_id: i.PO_Number }, temp))
|
|
|
|
- }
|
|
|
|
- if (i.PO_Number2) {
|
|
|
|
- t.push(Object.assign({ PO_id: i.PO_Number2 }, temp))
|
|
|
|
- }
|
|
|
|
- if (i.PO_Number3) {
|
|
|
|
- t.push(Object.assign({ PO_id: i.PO_Number3 }, temp))
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return t
|
|
|
|
- }, [] as any[])
|
|
|
|
- // console.log(formData, 'domestic tracking formdata')
|
|
|
|
- let size = 100
|
|
|
|
- const dataList = utils.splitArray(formData, size)
|
|
|
|
- const pool = []
|
|
|
|
- for (let i = 0; i < dataList.length; i++) {
|
|
|
|
- pool.push(
|
|
|
|
- createDomesticTrackingForm2(
|
|
|
|
- dataList[i],
|
|
|
|
- i,
|
|
|
|
- size,
|
|
|
|
- i === dataList.length - 1 ? formData.length : 0,
|
|
|
|
- ),
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
- loading.value = true
|
|
|
|
- Promise.all(pool).finally(() => {
|
|
|
|
- spliteDomesticTrackingAndPO2()
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const createDomesticTrackingForm2 = function (
|
|
|
|
- data: any[],
|
|
|
|
- currentPage = 0,
|
|
|
|
- pageSize = 1,
|
|
|
|
- finalValue: number,
|
|
|
|
-) {
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
- request
|
|
|
|
- .post('/payment_request/createDomesticTracking', data)
|
|
|
|
- .then((response) => {
|
|
|
|
- if (response.data.code !== 1) {
|
|
|
|
- ElNotification({
|
|
|
|
- type: 'error',
|
|
|
|
- duration: 0,
|
|
|
|
- title: 'DomesticTracking创建异常',
|
|
|
|
- message: `第 ${currentPage * pageSize + 1} ~ ${
|
|
|
|
- finalValue || (currentPage + 1) * pageSize
|
|
|
|
- } 行数据创建异常`,
|
|
|
|
- })
|
|
|
|
- reject(0)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- const res = response.data.result
|
|
|
|
- if (Array.isArray(res.data)) {
|
|
|
|
- const temp = res.data.map((i: any, index: number) => {
|
|
|
|
- return {
|
|
|
|
- status: i.status,
|
|
|
|
- index,
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- const temp2 = temp.filter((i: any) => i.status !== 'success')
|
|
|
|
-
|
|
|
|
- if (temp2.length) {
|
|
|
|
- ElNotification({
|
|
|
|
- type: 'error',
|
|
|
|
- duration: 0,
|
|
|
|
- title: 'DomesticTracking创建异常',
|
|
|
|
- message: `第 ${temp2
|
|
|
|
- .map((i: any) => i.index + 1 + currentPage * pageSize)
|
|
|
|
- .join(',')} 行数据创建异常`,
|
|
|
|
- })
|
|
|
|
- reject(0)
|
|
|
|
- } else {
|
|
|
|
- ElNotification({
|
|
|
|
- duration: 0,
|
|
|
|
- title: 'DomesticTracking创建成功',
|
|
|
|
- type: 'success',
|
|
|
|
- message: `第 ${currentPage * pageSize + 1} ~ ${
|
|
|
|
- finalValue || (currentPage + 1) * pageSize
|
|
|
|
- } 行数据创建成功`,
|
|
|
|
- })
|
|
|
|
- resolve(1)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const spliteDomesticTrackingAndPO2 = function () {
|
|
|
|
- const formData: any[] = tableData2.value.reduce((t, i, index) => {
|
|
|
|
- const temp: any = {
|
|
|
|
- Tracking_Number: i.Tracking_Number,
|
|
|
|
- // 这两个是固定的玩意, 暂定.
|
|
|
|
- Purchase_Order: {
|
|
|
|
- id: '4791186000155027611',
|
|
|
|
- name: 'PO11277 - 底层逻辑记录,不可删除 - 底层逻辑记录,不可删除',
|
|
|
|
- },
|
|
|
|
- Related_Domestic_Tracking: {
|
|
|
|
- id: '4791186000183903233',
|
|
|
|
- name: '底层逻辑记录,不可删除',
|
|
|
|
- },
|
|
|
|
- }
|
|
|
|
- if (i.PO_Number) {
|
|
|
|
- t.push(Object.assign({ PO_id: i.PO_Number }, temp))
|
|
|
|
- }
|
|
|
|
- if (i.PO_Number2) {
|
|
|
|
- t.push(Object.assign({ PO_id: i.PO_Number2 }, temp))
|
|
|
|
- }
|
|
|
|
- if (i.PO_Number3) {
|
|
|
|
- t.push(Object.assign({ PO_id: i.PO_Number3 }, temp))
|
|
|
|
- }
|
|
|
|
- return t
|
|
|
|
- }, [] as any[])
|
|
|
|
- // console.log(formData, 'form DomesticTrackingAndPO 2')
|
|
|
|
- let size = 100
|
|
|
|
- const dataList = utils.splitArray(formData, size)
|
|
|
|
- const pool = []
|
|
|
|
- for (let i = 0; i < dataList.length; i++) {
|
|
|
|
- pool.push(
|
|
|
|
- createDomesticTrackingAndPOForm2(
|
|
|
|
- dataList[i],
|
|
|
|
- i,
|
|
|
|
- size,
|
|
|
|
- i === dataList.length - 1 ? formData.length : 0,
|
|
|
|
- ),
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
- loading.value = true
|
|
|
|
- Promise.all(pool)
|
|
|
|
- .then(() => {
|
|
|
|
- tableData2.value = []
|
|
|
|
- statementID.value = ''
|
|
|
|
- })
|
|
|
|
- .finally(() => {
|
|
|
|
- loading.value = false
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const createDomesticTrackingAndPOForm2 = function (
|
|
|
|
- data: any[],
|
|
|
|
- currentPage = 0,
|
|
|
|
- pageSize = 1,
|
|
|
|
- finalValue: number,
|
|
|
|
-) {
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
- request
|
|
|
|
- .post('/payment_request/createDomesticPkgandPO', data)
|
|
|
|
- .then((response) => {
|
|
|
|
- if (response.data.code !== 1) {
|
|
|
|
- ElNotification({
|
|
|
|
- type: 'error',
|
|
|
|
- duration: 0,
|
|
|
|
- title: 'DomesticPkg_and_PO创建异常',
|
|
|
|
- message: `第 ${currentPage * pageSize + 1} ~ ${
|
|
|
|
- finalValue || (currentPage + 1) * pageSize
|
|
|
|
- } 行数据创建异常`,
|
|
|
|
- })
|
|
|
|
- reject(0)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- const res = response.data.result
|
|
|
|
- if (Array.isArray(res.data)) {
|
|
|
|
- const temp = res.data.map((i: any, index: number) => {
|
|
|
|
- return {
|
|
|
|
- status: i.status,
|
|
|
|
- index,
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- const temp2 = temp.filter((i: any) => i.status !== 'success')
|
|
|
|
-
|
|
|
|
- if (temp2.length) {
|
|
|
|
- ElNotification({
|
|
|
|
- type: 'error',
|
|
|
|
- duration: 0,
|
|
|
|
- title: 'DomesticPkg_and_PO创建异常',
|
|
|
|
- message: `第 ${temp2
|
|
|
|
- .map((i: any) => i.index + 1 + currentPage * pageSize)
|
|
|
|
- .join(',')} 行数据创建异常`,
|
|
|
|
- })
|
|
|
|
- reject(0)
|
|
|
|
- } else {
|
|
|
|
- ElNotification({
|
|
|
|
- duration: 0,
|
|
|
|
- title: 'DomesticPkg_and_PO创建成功',
|
|
|
|
- type: 'success',
|
|
|
|
- message: `第 ${currentPage * pageSize + 1} ~ ${
|
|
|
|
- finalValue || (currentPage + 1) * pageSize
|
|
|
|
- } 行数据创建成功`,
|
|
|
|
- })
|
|
|
|
- resolve(1)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
|
|
|
|
const dialogVisible = ref(false)
|
|
const dialogVisible = ref(false)
|
|
|
|
|