|
@@ -73,7 +73,25 @@
|
|
|
<el-table :data="form.orderDetailsList" v-if="JDorder">
|
|
|
<el-table-column label="产品编码" prop="code"> </el-table-column>
|
|
|
<el-table-column label="产品名称" prop="name"> </el-table-column>
|
|
|
- <el-table-column label="单价" prop="price"> </el-table-column>
|
|
|
+ <el-table-column label="单价" prop="price">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'orderDetailsList.' + scope.$index + '.price'"
|
|
|
+ :rules="formRules.price"
|
|
|
+ :inline-message="true"
|
|
|
+ label-width="0"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.price"
|
|
|
+ placeholder="请输入"
|
|
|
+ style="width: 100%"
|
|
|
+ size="mini"
|
|
|
+ @change="totalAmount"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="数量" prop="quantity">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
@@ -126,7 +144,25 @@
|
|
|
<el-table :data="form.orderDetailsList" v-else>
|
|
|
<el-table-column label="产品编码" prop="code"> </el-table-column>
|
|
|
<el-table-column label="产品名称" prop="name"> </el-table-column>
|
|
|
- <el-table-column label="单价" prop="price"> </el-table-column>
|
|
|
+ <el-table-column label="单价" prop="price">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'orderDetailsList.' + scope.$index + '.price'"
|
|
|
+ :rules="formRules.price"
|
|
|
+ :inline-message="true"
|
|
|
+ label-width="0"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.price"
|
|
|
+ placeholder="请输入"
|
|
|
+ style="width: 100%"
|
|
|
+ size="mini"
|
|
|
+ @change="totalAmount"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="数量" prop="quantity">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
@@ -401,6 +437,13 @@ export default {
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
],
|
|
|
+ price: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入单价",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
quantity: [
|
|
|
{
|
|
|
required: true,
|
|
@@ -452,13 +495,14 @@ export default {
|
|
|
(x) => x.productId === row.id
|
|
|
);
|
|
|
if (flag) return this.msgInfo("该产品您已选择");
|
|
|
+ let price = row.purchasePrice ? row.purchasePrice : "0";
|
|
|
this.form.orderDetailsList.push({
|
|
|
code: row.code,
|
|
|
name: row.name,
|
|
|
subtotal: "",
|
|
|
productId: row.id,
|
|
|
quantity: undefined,
|
|
|
- price: row.purchasePrice,
|
|
|
+ price: price,
|
|
|
remark: "",
|
|
|
});
|
|
|
} else {
|
|
@@ -466,13 +510,14 @@ export default {
|
|
|
(x) => x.productId === row.id
|
|
|
);
|
|
|
if (flag) return this.msgInfo("该产品您已选择");
|
|
|
+ let price = row.purchasePrice ? row.purchasePrice : "0";
|
|
|
this.form.orderDetailsList.push({
|
|
|
code: row.code,
|
|
|
name: row.name,
|
|
|
subtotal: "",
|
|
|
productId: row.id,
|
|
|
quantity: undefined,
|
|
|
- price: row.purchasePrice,
|
|
|
+ price: price,
|
|
|
remark: "",
|
|
|
});
|
|
|
}
|
|
@@ -490,18 +535,19 @@ export default {
|
|
|
totalAmount() {
|
|
|
if (this.JDorder) {
|
|
|
this.form.orderDetailsList.forEach((x) => {
|
|
|
- x.subtotal = Number(x.quantity) * Number(x.price);
|
|
|
+ x.subtotal = (x.quantity * (Number(x.price) * 100)) / 100;
|
|
|
});
|
|
|
this.form.money = this.form.orderDetailsList.reduce((sum, x) => {
|
|
|
return sum + Number(x.subtotal);
|
|
|
}, 0);
|
|
|
} else {
|
|
|
this.form.orderDetailsList.forEach((x) => {
|
|
|
- x.subtotal = Number(x.quantity) * Number(x.price);
|
|
|
+ x.subtotal = (x.quantity * (Number(x.price) * 100)) / 100;
|
|
|
});
|
|
|
this.form.money = this.form.orderDetailsList.reduce((sum, x) => {
|
|
|
return sum + Number(x.subtotal);
|
|
|
}, 0);
|
|
|
+ console.log(this.form.orderDetailsList, "sss");
|
|
|
}
|
|
|
},
|
|
|
handleSuccess(response, file, fileList) {
|