Commit e3d872de by zhuzhequan

工厂端pod对账单

parent 878ba2d9
......@@ -87,7 +87,7 @@ const router = createRouter({
},{
path: '/account/pod-bill-order',
meta: {
title: 'pod对账单',
title: 'POD对账单',
},
component: PodBillOrder,
},
......
......@@ -16,7 +16,9 @@ export interface AccountStatementNoteSearchForm {
orderNumber?: string
factory_status?: string
erp_status?: string
startTime?: string
start_time?: string
endTime?: string
end_time?: string
}
......@@ -26,6 +28,7 @@ export interface AccountStatementNote {
craft_total_amount?: number
pass_num?: number
factory_code?: string
total_amount?: string | number
num?: number
end_time?: string
rec_number?: string
......
......@@ -7,6 +7,8 @@ export interface BaseRespData<D> {
export interface PaginationData<D> {
page?: PaginationData<D>
craftPrice?: string
costPrice?: string
total: number
size: number
current: number
......
......@@ -29,7 +29,7 @@
<template #top>
<div class="header-filter-form">
<ElForm :model="searchForm" inline>
<ElFormItem label="创建时间">
<ElFormItem label="账期">
<div style="display: flex">
<el-date-picker
v-model="dateRange"
......@@ -77,7 +77,7 @@
<ElButton type="primary" @click="search">查询</ElButton>
</ElFormItem>
<ElFormItem>
<ElButton @click="resetSearchForm">重置</ElButton>
<ElButton @click="reset">重置</ElButton>
</ElFormItem>
</ElForm>
</div>
......@@ -156,7 +156,7 @@
</template>
</el-table-column>
<el-table-column
label="商品总价格(¥)"
label="工厂总价格(¥)"
header-align="center"
prop="product_total_amount"
width="130"
......@@ -197,16 +197,11 @@
align="center"
show-overflow-tooltip
>
<template #default="{row}">
{{
computedPrice(row)
}}
</template>
</el-table-column>
<el-table-column
label="实付金额(¥)"
header-align="center"
prop="actualAmount"
prop="actual_amount"
width="130"
align="center"
show-overflow-tooltip
......@@ -334,9 +329,6 @@
fixed="right"
>
<template #default="{ row }">
<!-- <el-button type="primary" link @click="onExport(row)"
>导出</el-button
> -->
<div>
<el-button
v-if="row.status===20"
......@@ -347,16 +339,7 @@
</el-button
>
</div>
<div>
<el-button
v-if="row.status===20"
type="danger"
link
@click="rejectedAction(row.id)"
>驳回
</el-button
>
</div>
</template>
</el-table-column>
</ElTable>
......@@ -428,6 +411,7 @@
</el-form-item>
<el-form-item>
<el-button
v-if="nodeId===1"
type="primary"
@click="priceModification(1)"
>修改工厂价格
......@@ -449,8 +433,12 @@
</el-form>
<div class="table-wrap">
<ElTable size="small" :data="detailList" height="100%" border
@selection-change="handleDetailSelectionChange">
<ElTable
size="small"
:data="detailList"
height="100%"
border
@selection-change="handleDetailSelectionChange">
<el-table-column
type="selection"
width="70"
......@@ -497,14 +485,6 @@
show-overflow-tooltip
></el-table-column>
<el-table-column
label="ERP价格(¥)"
prop="sales_price"
header-align="center"
align="center"
min-width="160"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="工艺价格(¥)"
prop="craft_price"
header-align="center"
......@@ -751,7 +731,7 @@
label="操作"
width="120">
<template #default="{row}">
<el-button type="success" @click="showLog(row)">操作日志</el-button>
<el-button type="primary" link @click="showLog(row)">操作日志</el-button>
</template>
</el-table-column>
<!-- <ElTableColumn
......@@ -864,11 +844,14 @@
{
required: true,
message: '请输入实付金额',
},{
type: 'number',
message: '实付金额需要为数字',
},
]"
>
<el-input
v-model="paymentForm.actualAmount"
v-model.number="paymentForm.actualAmount"
placeholder="请输入实付金额"
clearable
/>
......@@ -973,12 +956,10 @@ import { CircleClose, Plus } from '@element-plus/icons-vue'
import pendingReconciliation from './pendingReconciliation.vue'
import usePageList from '@/utils/hooks/usePageList'
import { useValue } from '@/utils/hooks/useValue'
import _ from 'lodash'
import BigNumber from 'bignumber.js'
import {
apiBillPodPayment,
apiItemLogList,
apiRejectedPodReconciliation,
auditOrderApi,
confirmPodOrderApi,
exportPodExcelApi,
......@@ -1033,6 +1014,8 @@ const treeData = ref<CountStatus[]>()
const [searchForm, resetSearchForm] = useValue<AccountStatementNoteSearchForm>(
{},
)
const paymentFormRef = ref()
const uploadLoading = ref(false)
const dateRange = ref<string[]>([])
......@@ -1068,17 +1051,22 @@ const {
{
...searchForm.value,
status: nodeId.value === -1 ? null : nodeId.value,
start_time: dateRange.value && dateRange.value[0],
end_time: dateRange.value && dateRange.value[1],
startTime: dateRange.value && dateRange.value[0],
endTime: dateRange.value && dateRange.value[1],
},
page,
pageSize,
).then((res) => res.data) as never,
})
onMounted(() => {
// getNameSpaceList()
})
watch(()=>tableData.value,()=>{
(tableData.value as AccountStatementNote[]).forEach((item)=>{
item.total_amount = computedPrice(item)
})
},{immediate:true,deep:true})
const reset = () => {
dateRange.value =[]
resetSearchForm()
}
const priceModification = (type: 1 | 3 | 4) => {
if (detailSelections.value.length === 0) {
ElMessage.warning('至少选择一条对账单')
......@@ -1102,8 +1090,8 @@ const priceModification = (type: 1 | 3 | 4) => {
inputErrorMessage: '请输入数字',
}).then(async ({ value }) => {
const price = parseFloat(value)
if (isNaN(price) || price <= 0) {
ElMessage.error('价格必须为大于0的数字')
if (isNaN(price) || price < 0) {
ElMessage.error('价格必须为大于等于0的数字')
return
}
await updateRecPrice({
......@@ -1113,16 +1101,14 @@ const priceModification = (type: 1 | 3 | 4) => {
})
ElMessage.success('操作成功')
detailSelections.value = []
search()
searchDetail()
})
}
const onPayment = async (item: AccountStatementNote) => {
currentRow.value = item
paymentForm.value = {
payableAmount: _.add(
item.product_total_amount || 0,
item.carriage_total_amount || 0,
),
payableAmount: item.total_amount,
actualAmount: '',
waterList: [],
}
......@@ -1137,6 +1123,9 @@ const handlePayment = async () => {
} catch {
return
}
if(Number(paymentForm.value.actualAmount)<=0){
return ElMessage.warning('实付金额需大于等于0')
}
await apiBillPodPayment({
...paymentForm.value,
waterList: paymentForm.value.waterList
......@@ -1149,24 +1138,6 @@ const handlePayment = async () => {
search()
}
const rejectedAction = async (id: number) => {
ElMessageBox.prompt('', '驳回原因', {
confirmButtonText: '确认',
cancelButtonText: '取消',
inputType: 'textarea',
inputPlaceholder: '请输入驳回原因',
inputPattern: /.+/,
inputErrorMessage: '驳回原因不能为空',
}).then(async ({ value }) => {
await apiRejectedPodReconciliation({
id: id,
description: value,
})
ElMessage.success('操作成功')
search()
})
}
const showLog = async (row: ItemList) => {
const res = await apiItemLogList(row.id)
logList.value = res.data || []
......@@ -1245,7 +1216,7 @@ const tabsClick = async () => {
const computedPrice = (row: AccountStatementNote) => {
return new BigNumber(row.product_total_amount || 0)
.plus(new BigNumber(row.carriage_total_amount || 0))
.plus(new BigNumber(row.craft_total_amount || 0))
.plus(new BigNumber(row.craft_total_amount || 0)).toString()
}
const toUpload = () => {
const input = document.createElement('input')
......@@ -1280,15 +1251,11 @@ const getSummaries = (param: SummaryMethodProps) => {
return
}
sums[index] = values
.reduce((prev: number, curr: number) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
.toString()
.reduce((prev: BigNumber, curr: number) => {
const value = new BigNumber(curr);
return prev.plus(value); // 直接处理 BigNumber 类型
}, new BigNumber(0))
.toString();
},
)
......
......@@ -9,11 +9,14 @@ import {
import { useValue } from '@/utils/hooks/useValue.ts'
import { AccountStatementNote, AccountStatementNoteSearchForm } from '@/types/api/billOrder.ts'
import { ref } from 'vue'
import { LogListsData } from '@/types/api/deliveryNote.ts'
import { LogListsData } from '@/types/api/deliveryNote.ts'
const [searchForm, resetSearchForm] = useValue<AccountStatementNoteSearchForm>(
{},
)
const logList = ref<LogListsData[]>([])
const craftPrice = ref<string | undefined>('')
const costPrice = ref<string | undefined>('')
const logDialogVisible = ref<boolean>(false)
const viewTheLog = async (id: number) => {
const res = await apiItemLogList(id)
......@@ -41,49 +44,56 @@ const {
startTime: dateRange.value && dateRange.value[0],
endTime: dateRange.value && dateRange.value[1],
},
).then((res) => res.data) as never,
).then((res) => {
craftPrice.value = res.data?.craftPrice
costPrice.value = res.data?.costPrice
return res.data
}) as never,
})
const handleSelectionChange = (v: AccountStatementNote[]) => {
selections.value = v
}
const reset = () => {
dateRange.value = []
resetSearchForm()
}
const priceModification = (type: 1 | 3 | 4) => {
if (selections.value.length === 0) {
ElMessage.warning("至少选择一条对账单");
return;
ElMessage.warning('至少选择一条对账单')
return
}
const pricePrompts: Record<1 | 3 | 4, { title: string; param: string }> =
const pricePrompts: Record<1 | 3 | 4, { title: string; param: string }> =
{
1: { title: "修改工厂价格", param: "costPrice" },
3: { title: "修改工艺价格", param: "craftPrice" },
4: { title: "修改物流价格", param: "carriageAmount" },
};
const promptConfig = pricePrompts[type];
1: { title: '修改工厂价格', param: 'costPrice' },
3: { title: '修改工艺价格', param: 'craftPrice' },
4: { title: '修改物流价格', param: 'carriageAmount' },
}
const promptConfig = pricePrompts[type]
if (!promptConfig) {
ElMessage.error("无效的操作类型");
return;
ElMessage.error('无效的操作类型')
return
}
ElMessageBox.prompt(promptConfig.title, {
confirmButtonText: "确定",
cancelButtonText: "取消",
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /\d+/,
inputErrorMessage: "请输入数字",
inputErrorMessage: '请输入数字',
}).then(async ({ value }) => {
const price = parseFloat(value);
if (isNaN(price) || price <= 0) {
ElMessage.error("价格必须为大于0的数字");
return;
const price = parseFloat(value)
if (isNaN(price) || price < 0) {
ElMessage.error('价格必须为大于等于0的数字')
return
}
await apiPodUpdatePrice({
ids: selections.value.map(item => item.id).join(),
...{ [promptConfig.param]: price },
});
ElMessage.success('操作成功');
selections.value = [];
})
ElMessage.success('操作成功')
selections.value = []
search()
});
};
})
}
</script>
<template>
......@@ -149,7 +159,7 @@ const priceModification = (type: 1 | 3 | 4) => {
<ElButton type="primary" @click="search">查询</ElButton>
</ElFormItem>
<ElFormItem>
<ElButton @click="resetSearchForm">重置</ElButton>
<ElButton @click="reset">重置</ElButton>
</ElFormItem>
</ElForm>
</div>
......@@ -157,13 +167,16 @@ const priceModification = (type: 1 | 3 | 4) => {
<el-button
type="primary"
@click="priceModification(1)"
>修改工厂价格</el-button
>修改工厂价格
</el-button
>
<el-button type="warning" @click="priceModification(3)"
>修改工艺价格</el-button
>修改工艺价格
</el-button
>
<el-button type="primary" @click="priceModification(4)"
>修改物流价格</el-button
>修改物流价格
</el-button
>
</div>
<div
......@@ -227,14 +240,6 @@ const priceModification = (type: 1 | 3 | 4) => {
show-overflow-tooltip
></el-table-column>
<el-table-column
label="ERP价格(¥)"
prop="sales_price"
header-align="center"
align="center"
min-width="160"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="工艺价格(¥)"
prop="craft_price"
header-align="center"
......@@ -515,17 +520,38 @@ const priceModification = (type: 1 | 3 | 4) => {
</el-table-column>
</ElTable>
</div>
<ElPagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[100, 200, 300, 400, 500]"
background
layout="total, sizes, prev, pager, next, jumper"
:total="total"
style="margin: 10px auto 0; text-align: right"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
></ElPagination>
<div class="pagination" style="display: flex;align-items:center;justify-content: center">
<div style="display:flex; position: relative;left: 200px;color: rgb(255, 153, 0);font-weight: bold" class="total-price">
<div style="display:flex;margin-right: 10px" class="total">
<div class="total-title">
工艺总价(¥):
</div>
<div class="total-price">
{{ craftPrice }}元
</div>
</div>
<div style="display:flex;" class="total">
<div class="total-title">
工厂价格(¥):
</div>
<div class="total-price">
{{ costPrice }}元
</div>
</div>
</div>
<ElPagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[100, 200, 300, 400, 500]"
background
layout="total, sizes, prev, pager, next, jumper"
:total="total"
style="margin: 10px auto 0; text-align: right"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
></ElPagination>
</div>
</div>
</div>
</template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment