|
|
|
@ -10,7 +10,14 @@ |
|
|
|
|
<div class="create" v-if="controlWindows.create"> |
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> |
|
|
|
|
<el-form-item label="客户名称" prop="customerId"> |
|
|
|
|
<el-select v-model="form.customerId" reserve-keyword remote :remote-method="customData" filterable placeholder="请选择客户"> |
|
|
|
|
<el-select |
|
|
|
|
v-model="form.customerId" |
|
|
|
|
reserve-keyword |
|
|
|
|
remote |
|
|
|
|
:remote-method="customData" |
|
|
|
|
filterable |
|
|
|
|
placeholder="请选择客户" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="(item, index) in customList" |
|
|
|
|
:key="index" |
|
|
|
@ -32,17 +39,26 @@ |
|
|
|
|
<autocomplete :params="form" :config="configAutocomplete" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="产品类型" prop="productType"> |
|
|
|
|
<el-select v-model="form.productType" @change="productChange" placeholder="请选择产品类型"> |
|
|
|
|
<el-select |
|
|
|
|
v-model="form.productType" |
|
|
|
|
@change="productChange" |
|
|
|
|
placeholder="请选择产品类型" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="(item, index) in productTypeList" |
|
|
|
|
:key="index" |
|
|
|
|
:label="item.label" |
|
|
|
|
:value="item.value" |
|
|
|
|
:label="item" |
|
|
|
|
:value="item" |
|
|
|
|
></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="产品名称" prop="productId"> |
|
|
|
|
<el-select :disabled="rowCreate" v-model="form.productId" @change="productDataList" placeholder="请选择产品类型"> |
|
|
|
|
<el-select |
|
|
|
|
:disabled="rowCreate" |
|
|
|
|
v-model="form.productId" |
|
|
|
|
@change="productDataList" |
|
|
|
|
placeholder="请选择产品类型" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="(item, index) in productNameList" |
|
|
|
|
:key="index" |
|
|
|
@ -74,11 +90,7 @@ |
|
|
|
|
吨 |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="订单金额"> |
|
|
|
|
<el-input |
|
|
|
|
maxlength="50" |
|
|
|
|
v-model="form.preAmount" |
|
|
|
|
disabled |
|
|
|
|
></el-input> |
|
|
|
|
<el-input maxlength="50" v-model="form.preAmount" disabled></el-input> |
|
|
|
|
元 |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
@ -103,21 +115,27 @@ export default { |
|
|
|
|
controlWindows: Object, |
|
|
|
|
// refineryTypeEnum: Array, |
|
|
|
|
}, |
|
|
|
|
watch:{ |
|
|
|
|
watch: { |
|
|
|
|
"form.salePrice": { |
|
|
|
|
handler(n, o) { |
|
|
|
|
if(n){ |
|
|
|
|
this.form.preAmount = (this.form.salePrice*(this.form.preQuantity?this.form.preQuantity:0)).toFixed(2) |
|
|
|
|
if (n) { |
|
|
|
|
this.form.preAmount = ( |
|
|
|
|
this.form.salePrice * |
|
|
|
|
(this.form.preQuantity ? this.form.preQuantity : 0) |
|
|
|
|
).toFixed(2); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
"form.preQuantity": { |
|
|
|
|
handler(n, o) { |
|
|
|
|
if(n){ |
|
|
|
|
this.form.preAmount = (this.form.preQuantity*(this.form.salePrice?this.form.salePrice:0)).toFixed(2) |
|
|
|
|
if (n) { |
|
|
|
|
this.form.preAmount = ( |
|
|
|
|
this.form.preQuantity * |
|
|
|
|
(this.form.salePrice ? this.form.salePrice : 0) |
|
|
|
|
).toFixed(2); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
let validatorRefineryId = (rule, value, callback) => { |
|
|
|
@ -125,18 +143,18 @@ export default { |
|
|
|
|
else callback("请选择炼厂"); |
|
|
|
|
}; |
|
|
|
|
return { |
|
|
|
|
rowCreate:false, |
|
|
|
|
customList:[], |
|
|
|
|
rowCreate: false, |
|
|
|
|
customList: [], |
|
|
|
|
form: { |
|
|
|
|
preAmount:0 |
|
|
|
|
preAmount: 0, |
|
|
|
|
}, |
|
|
|
|
productNameList:[], |
|
|
|
|
productNameList: [], |
|
|
|
|
refineryList: [], |
|
|
|
|
productRowData:{}, |
|
|
|
|
productRowData: {}, |
|
|
|
|
configAutocomplete: { |
|
|
|
|
serveTarget: serve.findByEntity, |
|
|
|
|
autocompleteKey: { |
|
|
|
|
key:"refineryName" |
|
|
|
|
key: "refineryName", |
|
|
|
|
}, |
|
|
|
|
labelKey: "refineryName", |
|
|
|
|
valueKey: "id", |
|
|
|
@ -145,24 +163,7 @@ export default { |
|
|
|
|
echoId: "", |
|
|
|
|
echoName: "", |
|
|
|
|
}, |
|
|
|
|
productTypeList: [ |
|
|
|
|
{ |
|
|
|
|
label: "0#柴", |
|
|
|
|
value: "0#", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "-10#柴", |
|
|
|
|
value: "-10#", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "92#汽", |
|
|
|
|
value: "92#", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "95#汽", |
|
|
|
|
value: "95#", |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
productTypeList: ["0#柴", "-10#柴", "92#汽", "95#汽"], |
|
|
|
|
rules: { |
|
|
|
|
customerId: [ |
|
|
|
|
{ required: true, message: "请输入客户名称", trigger: "blur" }, |
|
|
|
@ -183,77 +184,74 @@ 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 |
|
|
|
|
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; |
|
|
|
|
}, |
|
|
|
|
productChange(){ |
|
|
|
|
this.productData() |
|
|
|
|
productChange() { |
|
|
|
|
this.productData(); |
|
|
|
|
}, |
|
|
|
|
//搜索炼厂 |
|
|
|
|
refineryData(value){ |
|
|
|
|
refineryData(value) { |
|
|
|
|
if (value) { |
|
|
|
|
serve.findByEntity({refineryName:value}).then((res) => { |
|
|
|
|
serve.findByEntity({ refineryName: value }).then((res) => { |
|
|
|
|
this.refineryList = res.data; |
|
|
|
|
}); |
|
|
|
|
this.productData() |
|
|
|
|
this.productData(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//搜索产品 |
|
|
|
|
productData(){ |
|
|
|
|
productData() { |
|
|
|
|
let data = { |
|
|
|
|
refineryId:this.form.refineryId, |
|
|
|
|
productType:this.form.productType, |
|
|
|
|
enableMark:'ENABLE' |
|
|
|
|
} |
|
|
|
|
refineryId: this.form.refineryId, |
|
|
|
|
productType: this.form.productType, |
|
|
|
|
enableMark: "ENABLE", |
|
|
|
|
}; |
|
|
|
|
serve.getRefineryProductList(data).then((res) => { |
|
|
|
|
if(res.data.length>0){ |
|
|
|
|
if (res.data.length > 0) { |
|
|
|
|
this.productNameList = res.data; |
|
|
|
|
}else{ |
|
|
|
|
this.productNameList = [] |
|
|
|
|
this.form.productId = '' |
|
|
|
|
} else { |
|
|
|
|
this.productNameList = []; |
|
|
|
|
this.form.productId = ""; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
console.log(this.productRowData,'aaaaaaaaaa') |
|
|
|
|
}); |
|
|
|
|
console.log(this.productRowData, "aaaaaaaaaa"); |
|
|
|
|
}, |
|
|
|
|
//搜索客户 |
|
|
|
|
customData(value){ |
|
|
|
|
customData(value) { |
|
|
|
|
if (value) { |
|
|
|
|
serve.getRefineryCompanyList({name:value}).then((res) => { |
|
|
|
|
serve.getRefineryCompanyList({ name: value }).then((res) => { |
|
|
|
|
this.customList = res.data; |
|
|
|
|
this.form.customerId = this.$store.state.user.companyId |
|
|
|
|
console.log(this.form.customerId,'ssssaaaaaaaaaaaaaaa') |
|
|
|
|
this.form.customerId = this.$store.state.user.companyId; |
|
|
|
|
console.log(this.form.customerId, "ssssaaaaaaaaaaaaaaa"); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
openDrawer() { |
|
|
|
|
this.form = {} |
|
|
|
|
this.form = {}; |
|
|
|
|
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; |
|
|
|
|
this.form.salePrice = this.form.salePrice2company |
|
|
|
|
this.form.productId = this.form.id |
|
|
|
|
delete this.form.id |
|
|
|
|
this.rowCreate = true |
|
|
|
|
this.productChange() |
|
|
|
|
this.customData(this.$store.state.user.userCompanyName) |
|
|
|
|
|
|
|
|
|
console.log("this.form", this.$store.state.user,this.form); |
|
|
|
|
}else{ |
|
|
|
|
this.rowCreate = false |
|
|
|
|
this.form.salePrice = this.form.salePrice2company; |
|
|
|
|
this.form.productId = this.form.id; |
|
|
|
|
delete this.form.id; |
|
|
|
|
this.rowCreate = true; |
|
|
|
|
this.productChange(); |
|
|
|
|
this.customData(this.$store.state.user.userCompanyName); |
|
|
|
|
|
|
|
|
|
console.log("this.form", this.$store.state.user, this.form); |
|
|
|
|
} else { |
|
|
|
|
this.rowCreate = false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
submit() { |
|
|
|
|
this.$refs["form"].validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
|
|
|
|
|
this.judgeInterface(this.form).then((res) => { |
|
|
|
|
if (res.code === 20000) { |
|
|
|
|
this.$message.success(res.msg); |
|
|
|
@ -266,7 +264,7 @@ export default { |
|
|
|
|
judgeInterface(form) { |
|
|
|
|
// let { id } = this.controlWindows.addInfo; |
|
|
|
|
// if (id) return serve.update(form); |
|
|
|
|
// else |
|
|
|
|
// else |
|
|
|
|
return serve.orderSave(form); |
|
|
|
|
}, |
|
|
|
|
closeWindow() { |
|
|
|
|