pull/1/head
lixuan 2 years ago
parent b3ad85bca8
commit 608f5cdb98
  1. 2
      src/api/product.js
  2. 59
      src/views/product/components/create.vue

@ -39,7 +39,7 @@ const getRefineryCompanyList = (params) => {
// 下单 // 下单
const orderSave = (params) => { const orderSave = (params) => {
return request.postJson( return request.postJson(
"/oil_refinery/xoilRefineryOrder/save", "/oil-refinery/xoilRefineryOrder/save",
params params
); );
}; };

@ -37,7 +37,7 @@
<autocomplete :params="form" :config="configAutocomplete" /> <autocomplete :params="form" :config="configAutocomplete" />
</el-form-item> </el-form-item>
<el-form-item label="产品类型" prop="productType"> <el-form-item label="产品类型" prop="productType">
<el-select v-model="form.productType" filterable reserve-keyword remote :remote-method="productData" placeholder="请选择产品类型"> <el-select v-model="form.productType" @change="productChange" placeholder="请选择产品类型">
<el-option <el-option
v-for="(item, index) in productTypeList" v-for="(item, index) in productTypeList"
:key="index" :key="index"
@ -47,11 +47,19 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="产品名称"> <el-form-item label="产品名称">
<el-input <el-select v-model="form.productId" placeholder="请选择产品类型">
<el-option
v-for="(item, index) in productNameList"
:key="index"
:label="item.productName"
:value="item.id"
></el-option>
</el-select>
<!-- <el-input
maxlength="50" maxlength="50"
v-model="form.productName" v-model="form.productName"
placeholder="请输入产品名称" placeholder="请输入产品名称"
></el-input> ></el-input> -->
</el-form-item> </el-form-item>
<el-form-item label="销售价"> <el-form-item label="销售价">
<el-input <el-input
@ -98,6 +106,22 @@ export default {
controlWindows: Object, controlWindows: Object,
// refineryTypeEnum: Array, // refineryTypeEnum: Array,
}, },
watch:{
"form.salePrice": {
handler(n, o) {
if(n){
this.form.actAmount = 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)
}
},
}
},
data() { data() {
let validatorRefineryId = (rule, value, callback) => { let validatorRefineryId = (rule, value, callback) => {
if (this.form.refineryId) callback(); if (this.form.refineryId) callback();
@ -105,7 +129,10 @@ export default {
}; };
return { return {
customList:[], customList:[],
form: {}, form: {
actAmount:0
},
productNameList:[],
refineryList: [], refineryList: [],
configAutocomplete: { configAutocomplete: {
serveTarget: refineryInfoServe.findByEntity, serveTarget: refineryInfoServe.findByEntity,
@ -149,21 +176,28 @@ export default {
}; };
}, },
methods: { methods: {
productChange(){
this.productData()
},
// //
refineryData(value){ refineryData(value){
if (value) { if (value) {
serve.findByEntity({refineryName:value}).then((res) => { serve.findByEntity({refineryName:value}).then((res) => {
this.refineryList = res.data; this.refineryList = res.data;
}); });
this.productData()
} }
}, },
// //
productData(value){ productData(){
if (value) { let data = {
serve.getRefineryProductList({productType:value}).then((res) => { refineryId:this.form.refineryId,
this.customList = res.data; productType:this.form.productType,
}); enableMark:'ENABLE'
} }
serve.getRefineryProductList(data).then((res) => {
this.productNameList = res.data;
})
}, },
// //
customData(value){ customData(value){
@ -187,9 +221,10 @@ export default {
}); });
}, },
judgeInterface(form) { judgeInterface(form) {
let { id } = this.controlWindows.addInfo; // let { id } = this.controlWindows.addInfo;
if (id) return serve.update(form); // if (id) return serve.update(form);
else return serve.save(form); // else
return serve.orderSave(form);
}, },
//list //list
// findByEntity() { // findByEntity() {

Loading…
Cancel
Save