|
@@ -11,7 +11,7 @@
|
|
|
<div>
|
|
|
<labelTitle content="基本信息"></labelTitle>
|
|
|
</div>
|
|
|
- <el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="供应商" prop="supplierId">
|
|
|
<el-select
|
|
@@ -34,6 +34,32 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item label="是否合同" prop="isAgreement">
|
|
|
+ <el-radio-group v-model="form.isAgreement">
|
|
|
+ <el-radio label="1">是</el-radio>
|
|
|
+ <el-radio label="0">否</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item label="付款方式" prop="paymentMethod">
|
|
|
+ <el-select
|
|
|
+ v-model="form.paymentMethod"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in paymentMethodList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.dictValue"
|
|
|
+ :value="item.dictKey"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
@@ -85,6 +111,7 @@
|
|
|
:controls="false"
|
|
|
:min="1"
|
|
|
:max="9999999"
|
|
|
+ @change="changeTotalMoney"
|
|
|
>
|
|
|
</el-input-number>
|
|
|
</el-form-item>
|
|
@@ -105,8 +132,9 @@
|
|
|
style="width: 100%"
|
|
|
size="mini"
|
|
|
:controls="false"
|
|
|
- :min="1"
|
|
|
+ :min="0"
|
|
|
:max="9999999"
|
|
|
+ @change="changeTotalMoney"
|
|
|
>
|
|
|
</el-input-number>
|
|
|
</el-form-item>
|
|
@@ -120,7 +148,12 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column label="操作" width="100" align="left">
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ width="100"
|
|
|
+ align="center"
|
|
|
+ fixed="right"
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
<el-button type="text" @click="deleteRow(scope.$index)"
|
|
|
>删除</el-button
|
|
@@ -129,6 +162,99 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
+ <div style="margin-top: 20px">
|
|
|
+ <labelTitle content="其他费用"></labelTitle>
|
|
|
+ </div>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ style="margin: 20px 0 10px 0"
|
|
|
+ @click="handleAddOther"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
+ <el-form-item>
|
|
|
+ <el-table :data="form.otherFeeList">
|
|
|
+ <el-table-column label="费用名称" prop="goodsUnit">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'otherFeeList.' + scope.$index + '.name'"
|
|
|
+ :rules="formRules.name"
|
|
|
+ :inline-message="true"
|
|
|
+ label-width="0px"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.name"
|
|
|
+ size="mini"
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="费用金额" prop="quantityOne">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'otherFeeList.' + scope.$index + '.price'"
|
|
|
+ :rules="formRules.price"
|
|
|
+ :inline-message="true"
|
|
|
+ label-width="0px"
|
|
|
+ >
|
|
|
+ <el-input-number
|
|
|
+ v-model="scope.row.price"
|
|
|
+ placeholder="请输入"
|
|
|
+ size="mini"
|
|
|
+ style="width: 100%"
|
|
|
+ :controls="false"
|
|
|
+ @change="changeTotalMoney"
|
|
|
+ >
|
|
|
+ </el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="备注" prop="remark">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'otherFeeList.' + scope.$index + '.remark'"
|
|
|
+ :rules="formRules.remark"
|
|
|
+ :inline-message="true"
|
|
|
+ size="mini"
|
|
|
+ label-width="0px"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.remark"
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ width="100"
|
|
|
+ align="center"
|
|
|
+ fixed="right"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" @click="deleteOtherRow(scope.$index)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form-item>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item label="总金额">
|
|
|
+ <el-input-number
|
|
|
+ v-model="form.totalPrice"
|
|
|
+ style="width: 100%"
|
|
|
+ disabled
|
|
|
+ :controls="false"
|
|
|
+ >
|
|
|
+ </el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -183,31 +309,48 @@ export default {
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
],
|
|
|
+ isAgreement: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择是否合同",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ paymentMethod: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择付款方式",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ name: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入费用名称",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ price: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入费用金额",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ // remark: [
|
|
|
+ // {
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入备注",
|
|
|
+ // trigger: "blur",
|
|
|
+ // },
|
|
|
+ // ],
|
|
|
},
|
|
|
- queryParams: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- keyword: "",
|
|
|
- supplierId: "",
|
|
|
- materialId: "",
|
|
|
- supplierName: "",
|
|
|
- materialName: "",
|
|
|
- materialCode: "",
|
|
|
- materialType: "",
|
|
|
- },
|
|
|
- tableList: [],
|
|
|
priceData: {},
|
|
|
+ otherForm: {},
|
|
|
+ paymentMethodList: [],
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
- // supplyPriceList(this.queryParams).then(
|
|
|
- // (res) => {
|
|
|
- // this.tableList = res.data.data.records;
|
|
|
- // },
|
|
|
- // (err) => {
|
|
|
- // console.log("supplyPriceList: " + err);
|
|
|
- // }
|
|
|
- // );
|
|
|
const businessDictData = JSON.parse(
|
|
|
window.localStorage.getItem("businessDict")
|
|
|
);
|
|
@@ -218,10 +361,18 @@ export default {
|
|
|
(item) => item.code === "supplyType"
|
|
|
).children;
|
|
|
|
|
|
+ this.paymentMethodList = businessDictData.find(
|
|
|
+ (item) => item.code === "paymentMethod"
|
|
|
+ ).children;
|
|
|
+
|
|
|
supplySelect({ name: "", code: "", type: "" }).then((res) => {
|
|
|
this.supplySelectList = res.data.data;
|
|
|
});
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ this.changeTotalMoney();
|
|
|
+ console.log(this.form, "wwws");
|
|
|
+ },
|
|
|
methods: {
|
|
|
// handleSubmit() {
|
|
|
// this.$refs.ruleForm.validate((valid) => {
|
|
@@ -267,6 +418,7 @@ export default {
|
|
|
}
|
|
|
this.form.goodsList.splice(index, 1);
|
|
|
this.msgSuccess("删除成功");
|
|
|
+ this.changeTotalMoney();
|
|
|
},
|
|
|
handleChangeSupply(val) {
|
|
|
const productIdList = this.form.goodsList.map((x) => {
|
|
@@ -286,8 +438,36 @@ export default {
|
|
|
this.form.goodsList[i].unitPrice = "";
|
|
|
}
|
|
|
}
|
|
|
+ this.changeTotalMoney();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleAddOther() {
|
|
|
+ this.form.otherFeeList.push({
|
|
|
+ name: "",
|
|
|
+ price: undefined,
|
|
|
+ remark: "",
|
|
|
});
|
|
|
},
|
|
|
+ deleteOtherRow(index) {
|
|
|
+ this.form.otherFeeList.splice(index, 1);
|
|
|
+ this.msgSuccess("删除成功");
|
|
|
+ this.changeTotalMoney();
|
|
|
+ },
|
|
|
+ changeTotalMoney() {
|
|
|
+ let productTotal = 0;
|
|
|
+ for (let i = 0; i < this.form.goodsList.length; i++) {
|
|
|
+ const e = this.form.goodsList[i];
|
|
|
+ let num = Number(e.quantity) * Number(e.unitPrice);
|
|
|
+ productTotal = productTotal + num;
|
|
|
+ }
|
|
|
+ let otherTotal = 0;
|
|
|
+ for (let i = 0; i < this.form.otherFeeList.length; i++) {
|
|
|
+ const e = this.form.otherFeeList[i];
|
|
|
+ otherTotal = otherTotal + Number(e.price);
|
|
|
+ }
|
|
|
+ this.form.totalPrice = productTotal + otherTotal;
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|