fix:出入库明细页单价/金额/合计改用后端返回的unit_price、price、total_price,修复前端浮点计算误差;库存导出总金额保留两位

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
caoqianming 2026-07-14 10:24:08 +08:00
parent 02f3d3e3dd
commit 0c73337a9a
2 changed files with 5 additions and 15 deletions

View File

@ -214,7 +214,7 @@ export default {
that.$API.inm.warehouse.batch.req({ page: 0, count__gte: 1, material__type__in: "40" }).then((res) => {
res.forEach(item => {
let data0 = [];
let total = Number(item.material_.unit_price)*Number(item.count);
let total = Math.round(Number(item.material_.unit_price)*Number(item.count)*100)/100;
data0.push(item.update_time);
data0.push(item.material_.number);
data0.push(item.material_.name);

View File

@ -104,15 +104,9 @@
<el-link v-else :underline="false" type="primary" @click="showWpr(scope.row)">{{scope.row.count}}</el-link>
</template>
</el-table-column>
<el-table-column label="单价" prop="price" v-if="cate == 'helpso'&&project_code=='gx'">
<template #default="scope">
<span v-if="scope.row.material_">{{ scope.row.material_.unit_price }}</span>
</template>
<el-table-column label="单价" prop="unit_price" v-if="cate == 'helpso'&&project_code=='gx'">
</el-table-column>
<el-table-column label="金额" prop="price" v-if="cate == 'helpso'&&project_code=='gx'">
<template #default="scope">
<span v-if="scope.row.material_">{{ scope.row.count * Number(scope.row.material_.unit_price) }}</span>
</template>
</el-table-column>
<el-table-column label="发出数量" prop="count_send" v-if="mioObj.type == 'sale_out'&&project_code=='gx'">
</el-table-column>
@ -721,13 +715,9 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
}
}
if(index==7&&this.cate == 'helpso'&&this.project_code=='gx'){
let sumsss = 0;
data.forEach((item)=>{
if(item.count&&item.material_.unit_price&&item.material_.unit_price!==null){
sumsss += Number(item.count)*Number(item.material_.unit_price);
}
})
sums[index] =sumsss;
//
const total = this.mioObj ? this.mioObj.total_price : null;
sums[index] = total !== null && total !== undefined ? total : '';
}
});