Commit e3d872de by zhuzhequan

工厂端pod对账单

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