fix:入库出库表尾合计;导入每日菜品成功刷新分类
This commit is contained in:
1 parent
075b4f41bb
commit
52aa57bf6f
5 files changed
+60
-20
No files matched your search
@@ -62,6 +62,7 @@
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
<el-button icon="Refresh" @click="foodMultipleTableRef.clearSelection()">取消所有勾选</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
<el-input-number v-model="form.price" :min="0" :precision="2" placeholder="请输入商品价格" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="14" class="mb20">-->
|
||||
<!-- <el-form-item label="市场价" prop="marketPrice">-->
|
||||
<!-- <el-input-number v-model="form.marketPrice" :min="0" :precision="2" placeholder="请输入市场价" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="14" class="mb20">-->
|
||||
<!-- <el-form-item label="市场价" prop="marketPrice">-->
|
||||
<!-- <el-input-number v-model="form.marketPrice" :min="0" :precision="2" placeholder="请输入市场价" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="14" class="mb20">
|
||||
<el-form-item label="库存" prop="stock">
|
||||
<el-input-number v-model="form.stock" :min="0" :precision="0" placeholder="请输入库存" />
|
||||
@@ -164,6 +164,7 @@ const getcanteenOnlineSpuData = (id: string) => {
|
||||
price: Number(displayPrice(res.data.price, "")),
|
||||
marketPrice: Number(displayPrice(res.data.marketPrice, "")),
|
||||
status: "" + res.data.status,
|
||||
description: res.data.description ?? "",
|
||||
})
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
@@ -118,8 +118,8 @@
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<!-- 关联每日菜品 -->
|
||||
<export-form-dialog ref="exportFormDialogRef" @refresh="getDataList(false)" />
|
||||
<!-- 导入每日菜品 -->
|
||||
<export-form-dialog ref="exportFormDialogRef" @refresh="exportRefresh" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -151,13 +151,17 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getCanteenOnlineCategoryAll()
|
||||
})
|
||||
|
||||
const getCanteenOnlineCategoryAll = async () => {
|
||||
try {
|
||||
const res = await getCanteenOnlineCategory()
|
||||
categoryOptions.value = res.data.records
|
||||
} catch (error) {
|
||||
categoryOptions.value = []
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
@@ -197,4 +201,10 @@ const handleDelete = async (ids: string[]) => {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
|
||||
// 导入每日菜品成功刷新
|
||||
const exportRefresh = () => {
|
||||
getDataList(false)
|
||||
getCanteenOnlineCategoryAll()
|
||||
}
|
||||
</script>
|
||||
@@ -69,8 +69,16 @@
|
||||
:data="vxeTableData"
|
||||
:edit-rules="validRules"
|
||||
show-footer
|
||||
:footer-data="[{ seq: '合计', totalAmount }]"
|
||||
:merge-footer-items="[{ row: 0, col: 2, rowspan: 1, colspan: 7 }]"
|
||||
:footer-data="[
|
||||
{
|
||||
seq: '合计',
|
||||
quantity: total.quantity,
|
||||
purchasePrice: total.purchasePrice,
|
||||
realPrice: `${total.realPrice}元`,
|
||||
totalAmount: total.totalAmount,
|
||||
},
|
||||
]"
|
||||
:merge-footer-items="[{ row: 0, col: 2, rowspan: 1, colspan: 4 }]"
|
||||
@checkbox-all=""
|
||||
@checkbox-change=""
|
||||
size="mini"
|
||||
@@ -148,7 +156,7 @@
|
||||
<el-input-number v-if="row.selectedUnitObj" v-model="row.selectedUnitObj.totalAmount" :min="0" :precision="2" />
|
||||
</template>
|
||||
<template #footer="{ row }">
|
||||
<span style="color: #2e5cf6; font-weight: bold">{{ totalAmount }} 元</span>
|
||||
<span style="color: #2e5cf6; font-weight: bold">{{ total.totalAmount }}元</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="remark" title="备注" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
@@ -235,9 +243,15 @@ const validRules = ref<VxeTablePropTypes.EditRules<any>>({
|
||||
})
|
||||
|
||||
// 合计总金额
|
||||
const totalAmount = computed(() =>
|
||||
vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.totalAmount || 0), 0).toFixed(2),
|
||||
)
|
||||
const total = computed(() => {
|
||||
const quantity = vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.quantity || 0), 0).toFixed(2)
|
||||
const purchasePrice = displayPrice(
|
||||
vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.purchasePrice || 0), 0),
|
||||
)
|
||||
const realPrice = vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.realPrice || 0), 0)
|
||||
const totalAmount = vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.totalAmount || 0), 0).toFixed(2)
|
||||
return { quantity, purchasePrice, realPrice, totalAmount }
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getInitData()
|
||||
|
||||
@@ -97,8 +97,16 @@
|
||||
:data="vxeTableData"
|
||||
:edit-rules="validRules"
|
||||
show-footer
|
||||
:footer-data="[{ seq: '合计', totalAmount }]"
|
||||
:merge-footer-items="[{ row: 0, col: 2, rowspan: 1, colspan: 7 }]"
|
||||
:footer-data="[
|
||||
{
|
||||
seq: '合计',
|
||||
quantity: total.quantity,
|
||||
purchasePrice: total.purchasePrice,
|
||||
realPrice: `${total.realPrice}元`,
|
||||
totalAmount: total.totalAmount,
|
||||
},
|
||||
]"
|
||||
:merge-footer-items="[{ row: 0, col: 2, rowspan: 1, colspan: 4 }]"
|
||||
@checkbox-all=""
|
||||
@checkbox-change=""
|
||||
size="mini"
|
||||
@@ -176,7 +184,7 @@
|
||||
<el-input-number v-if="row.selectedUnitObj" v-model="row.selectedUnitObj.totalAmount" :min="0" :precision="2" />
|
||||
</template>
|
||||
<template #footer="{ row }">
|
||||
<span style="color: #2e5cf6; font-weight: bold">{{ totalAmount }} 元</span>
|
||||
<span style="color: #2e5cf6; font-weight: bold">{{ total.totalAmount }}元</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="remark" title="备注" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
@@ -263,9 +271,15 @@ const validRules = ref<VxeTablePropTypes.EditRules<any>>({
|
||||
})
|
||||
|
||||
// 合计总金额
|
||||
const totalAmount = computed(() =>
|
||||
vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.totalAmount || 0), 0).toFixed(2),
|
||||
)
|
||||
const total = computed(() => {
|
||||
const quantity = vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.quantity || 0), 0).toFixed(2)
|
||||
const purchasePrice = displayPrice(
|
||||
vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.purchasePrice || 0), 0),
|
||||
)
|
||||
const realPrice = vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.realPrice || 0), 0)
|
||||
const totalAmount = vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.totalAmount || 0), 0).toFixed(2)
|
||||
return { quantity, purchasePrice, realPrice, totalAmount }
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getInitData()
|
||||
|
||||
Reference in new issue
Block a user