This commit is contained in:
lixuan
2023-02-22 10:14:10 +08:00
parent 1ccc6803e7
commit b3502c348d
6 changed files with 653 additions and 74 deletions

View File

@@ -1,16 +1,16 @@
<template>
<el-drawer
title="创建订单"
:title="controlWindows.addInfo.title"
direction="ltr"
size="40%"
:visible="controlWindows.create"
@opened="openDrawer"
:before-close="closeWindow"
>
<div class="create">
<div class="create" v-if="controlWindows.create">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="客户名称" prop="productName">
<el-select v-model="form.customId" reserve-keyword remote :remote-method="customData" filterable placeholder="请选择客户">
<el-form-item label="客户名称" prop="customerId">
<el-select v-model="form.customerId" reserve-keyword remote :remote-method="customData" filterable placeholder="请选择客户">
<el-option
v-for="(item, index) in customList"
:key="index"
@@ -46,8 +46,8 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="产品名称">
<el-select v-model="form.productId" placeholder="请选择产品类型">
<el-form-item label="产品名称" prop="productId">
<el-select v-model="form.productId" @change="productDataList" placeholder="请选择产品类型">
<el-option
v-for="(item, index) in productNameList"
:key="index"
@@ -66,6 +66,7 @@
maxlength="50"
v-model="form.salePrice"
placeholder="请输入销售价"
disabled
></el-input>
/
</el-form-item>
@@ -80,9 +81,10 @@
<el-form-item label="订单金额">
<el-input
maxlength="50"
v-model="form.actAmount"
v-model="form.preAmount"
disabled
></el-input>
</el-form-item>
</el-form>
</div>
@@ -110,14 +112,14 @@ export default {
"form.salePrice": {
handler(n, o) {
if(n){
this.form.actAmount = this.form.salePrice*(this.form.preQuantity?this.form.preQuantity:0)
this.form.preAmount = this.form.salePrice*(this.form.preQuantity?this.form.preQuantity:0)
}
},
},
"form.preQuantity": {
handler(n, o) {
if(n){
this.form.actAmount = this.form.preQuantity*(this.form.salePrice?this.form.salePrice:0)
this.form.preAmount = this.form.preQuantity*(this.form.salePrice?this.form.salePrice:0)
}
},
}
@@ -130,10 +132,11 @@ export default {
return {
customList:[],
form: {
actAmount:0
preAmount:0
},
productNameList:[],
refineryList: [],
productRowData:{},
configAutocomplete: {
serveTarget: refineryInfoServe.findByEntity,
autocompleteKey: "refineryName",
@@ -141,6 +144,8 @@ export default {
valueKey: "id",
placeholder: "炼厂名称",
querykey: "refineryId",
echoId: "",
echoName: "",
},
productTypeList: [
{
@@ -161,8 +166,11 @@ export default {
},
],
rules: {
productName: [
{ required: true, message: "请输入产品名称", trigger: "blur" },
customerId: [
{ required: true, message: "请输入客户名称", trigger: "blur" },
],
productId: [
{ required: true, message: "请输入产品名称", trigger: "change" },
],
refineryId: [
{ required: true, validator: validatorRefineryId, trigger: "change" },
@@ -177,6 +185,15 @@ export default {
};
},
methods: {
productDataList(e){
this.productRowData = this.productNameList.filter(
(item) => item.id == e
);
this.form.salePrice = this.productRowData[0].salePrice2company
this.form.floorPrice = this.productRowData[0].floorPrice
this.form.productMeasurement = this.productRowData[0].measurement
console.log(this.productRowData,'sssssssdddddddddddddd')
},
productChange(){
this.productData()
},
@@ -208,10 +225,20 @@ export default {
});
}
},
openDrawer() {},
openDrawer() {
let { id } = this.controlWindows.addInfo;
if (id) {
//回显
this.form = JSON.parse(JSON.stringify(this.controlWindows.addInfo));
this.configAutocomplete.echoId = id;
this.configAutocomplete.echoName = this.form.refineryName;
console.log("this.form", this.form.floorPrice);
}
},
submit() {
this.$refs["form"].validate((valid) => {
if (valid) {
this.judgeInterface(this.form).then((res) => {
if (res.code === 20000) {
this.$message.success(res.msg);

View File

@@ -137,7 +137,7 @@
<el-dropdown-item command="record">调价记录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<span class="el-dropdown-link">下单</span>
<span class="el-dropdown-link" @click="updateCreate(row)">下单</span>
<el-dropdown
@command="
(val) => {
@@ -330,8 +330,16 @@ export default {
//下单
createOrder(row) {
this.controlWindows.addInfo.title = "创建订单";
this.controlWindows.create = true;
console.log(this.controlWindows.create);
},
//修改订单
updateCreate(row){
this.controlWindows.addInfo = {
title: "修改订单",
...row,
};
this.controlWindows.create = true;
},
//详情
detail(row) {