6 Commits

Author SHA1 Message Date
xiaozhiyong
704f3f56d9 更新 2023-04-03 16:29:48 +08:00
xiaozhiyong
5f73c912e1 更新 2023-04-03 16:24:29 +08:00
xiaozhiyong
8d4e877949 更新 2023-03-17 15:56:18 +08:00
xiaozhiyong
69ec812147 Merge branch 'master' of http://121.196.213.68:3000/xiaozhiyong/refinery-admin 2023-03-17 15:21:29 +08:00
xiaozhiyong
402316d8af 更新 2023-03-17 15:21:11 +08:00
367204d3c6 Merge pull request 'xiugai' (#8) from lixuan into master
Reviewed-on: #8
2023-03-17 06:13:00 +00:00
4 changed files with 116 additions and 160 deletions

View File

@@ -34,14 +34,14 @@ const modifyPrice = (params) => {
}; };
// 搜索客户 // 搜索客户
const getRefineryCompanyList = (params) => { const getRefineryCompanyList = (params) => {
return request.postJson("/oil-user/oilCompanyInfo/getLikeByCompanyType", params); return request.postJson(
"/oil-user/oilCompanyInfo/getLikeByCompanyType",
params
);
}; };
// 下单 // 下单
const orderSave = (params) => { const orderSave = (params) => {
return request.postJson( return request.postJson("/oil-refinery/xoilRefineryOrder/save", params);
"/oil-refinery/xoilRefineryOrder/save",
params
);
}; };
//查看企业产品 //查看企业产品
const getRefineryProductList = (params) => { const getRefineryProductList = (params) => {
@@ -50,13 +50,13 @@ const getRefineryProductList = (params) => {
params params
); );
}; };
//查看炼厂信息 // //查看炼厂信息
const findByEntity = (params) => { // const findByEntity = (params) => {
return request.postJson( // return request.postJson(
"/oil-refinery/xoilRefineryInfo/findByEntity", // "/oil-refinery/xoilRefineryInfo/findByEntity",
params // params
); // );
}; // };
export default { export default {
getByPage, getByPage,
@@ -68,5 +68,5 @@ export default {
getRefineryCompanyList, getRefineryCompanyList,
orderSave, orderSave,
getRefineryProductList, getRefineryProductList,
findByEntity // findByEntity
}; };

View File

@@ -21,8 +21,8 @@
<el-option <el-option
v-for="(item, index) in productTypeList" v-for="(item, index) in productTypeList"
:key="index" :key="index"
:label="item.label" :label="item"
:value="item.value" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@@ -115,7 +115,7 @@ export default {
}; };
return { return {
form: { form: {
measurement:'吨' measurement: "吨",
}, },
refineryList: [], refineryList: [],
configAutocomplete: { configAutocomplete: {
@@ -131,24 +131,7 @@ export default {
echoId: "", echoId: "",
echoName: "", echoName: "",
}, },
productTypeList: [ productTypeList: ["0#柴", "-10#柴", "92#汽", "95#汽"],
{
label: "0#柴",
value: "0#柴",
},
{
label: "-10#柴",
value: "-10#柴",
},
{
label: "92#汽",
value: "92#汽",
},
{
label: "95#汽",
value: "95#汽",
},
],
rules: { rules: {
productName: [ productName: [
{ required: true, message: "请输入产品名称", trigger: "blur" }, { required: true, message: "请输入产品名称", trigger: "blur" },
@@ -211,7 +194,7 @@ export default {
closeWindow() { closeWindow() {
this.$emit("closeWindow"); this.$emit("closeWindow");
this.form = {}; this.form = {};
this.form.measurement = '吨' this.form.measurement = "吨";
this.controlWindows.addInfo = {}; this.controlWindows.addInfo = {};
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.autocomplete.list = []; this.$refs.autocomplete.list = [];

View File

@@ -10,7 +10,14 @@
<div class="create" v-if="controlWindows.create"> <div class="create" v-if="controlWindows.create">
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="客户名称" prop="customerId"> <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 <el-option
v-for="(item, index) in customList" v-for="(item, index) in customList"
:key="index" :key="index"
@@ -38,17 +45,26 @@
</el-form-item> </el-form-item>
<el-form-item label="产品类型" prop="productType"> <el-form-item label="产品类型" prop="productType">
<!-- <autocomplete :params="form" :config="configAutocompleteCp" /> --> <!-- <autocomplete :params="form" :config="configAutocompleteCp" /> -->
<el-select v-model="form.productType" @change="productChange" 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"
:label="item.label" :label="item"
:value="item.value" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="产品名称" prop="productId"> <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 <el-option
v-for="(item, index) in productNameList" v-for="(item, index) in productNameList"
:key="index" :key="index"
@@ -80,11 +96,7 @@
</el-form-item> </el-form-item>
<el-form-item label="订单金额"> <el-form-item label="订单金额">
<el-input <el-input maxlength="50" v-model="form.preAmount" disabled></el-input>
maxlength="50"
v-model="form.preAmount"
disabled
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -98,6 +110,7 @@
<script> <script>
import serve from "api/product.js"; import serve from "api/product.js";
import refineryInfoServe from "api/refineryInfo.js";
import autocomplete from "components/autocomplete/index.vue"; import autocomplete from "components/autocomplete/index.vue";
export default { export default {
@@ -108,21 +121,27 @@ export default {
controlWindows: Object, controlWindows: Object,
// refineryTypeEnum: Array, // refineryTypeEnum: Array,
}, },
watch:{ watch: {
"form.salePrice": { "form.salePrice": {
handler(n, o) { handler(n, o) {
if(n){ if (n) {
this.form.preAmount = (this.form.salePrice*(this.form.preQuantity?this.form.preQuantity:0)).toFixed(2) this.form.preAmount = (
this.form.salePrice *
(this.form.preQuantity ? this.form.preQuantity : 0)
).toFixed(2);
} }
}, },
}, },
"form.preQuantity": { "form.preQuantity": {
handler(n, o) { handler(n, o) {
if(n){ if (n) {
this.form.preAmount = (this.form.preQuantity*(this.form.salePrice?this.form.salePrice:0)).toFixed(2) this.form.preAmount = (
this.form.preQuantity *
(this.form.salePrice ? this.form.salePrice : 0)
).toFixed(2);
} }
}, },
} },
}, },
data() { data() {
let validatorRefineryId = (rule, value, callback) => { let validatorRefineryId = (rule, value, callback) => {
@@ -130,16 +149,19 @@ export default {
else callback("请选择炼厂"); else callback("请选择炼厂");
}; };
return { return {
customList:[], customList: [],
form: { form: {
preAmount:0 preAmount: 0,
}, },
productNameList:[], productNameList: [],
refineryList: [], refineryList: [],
productRowData:{}, productRowData: {},
configAutocomplete: { configAutocomplete: {
serveTarget: serve.findByEntity, serveTarget: refineryInfoServe.findByEntity,
autocompleteKey: "refineryName", autocompleteKey: {
key: "refineryName",
enableMark: "ENABLE",
},
labelKey: "refineryName", labelKey: "refineryName",
valueKey: "id", valueKey: "id",
placeholder: "炼厂名称", placeholder: "炼厂名称",
@@ -147,25 +169,8 @@ export default {
echoId: "", echoId: "",
echoName: "", echoName: "",
}, },
rowCreate:false, rowCreate: false,
productTypeList: [ productTypeList: ["0#柴", "-10#柴", "92#汽", "95#汽"],
{
label: "0#柴",
value: "0#",
},
{
label: "-10#柴",
value: "-10#",
},
{
label: "92#汽",
value: "92#",
},
{
label: "95#汽",
value: "95#",
},
],
rules: { rules: {
customerId: [ customerId: [
{ required: true, message: "请输入客户名称", trigger: "blur" }, { required: true, message: "请输入客户名称", trigger: "blur" },
@@ -186,76 +191,61 @@ export default {
}; };
}, },
methods: { methods: {
productDataList(e){
console.log(e,'ppppppppppppppp')
this.productRowData = this.productNameList.filter(
(item) => item.id == e
);
this.form.salePrice = this.productRowData[0].salePrice2company
this.form.floorPrice = this.productRowData[0].floorPrice
},
productChange(){
this.productData()
},
//搜索炼厂
refineryData(value){
if (value) {
serve.findByEntity({refineryName:value}).then((res) => {
this.refineryList = res.data;
});
this.productData()
}
},
//搜索产品
async productData(){
let data = {
refineryId:this.form.refineryId,
productType:this.form.productType,
enableMark:'ENABLE'
}
await serve.getRefineryProductList(data).then((res) => {
if(res.data.length>0){
this.productNameList = res.data;
}else{
this.productNameList = []
this.form.productId = ''
}
})
// this.form.productId = this.productNameList[0].productId
console.log(this.productRowData,this.productNameList,'aaaaaaaaaa')
},
//搜索客户
customData(value){
if (value) {
serve.getRefineryCompanyList({name:value}).then((res) => {
this.customList = res.data;
});
}
},
openDrawer() { openDrawer() {
this.form = {} this.form = {};
let { id } = this.controlWindows.addInfo; let { id } = this.controlWindows.addInfo;
if (id) { if (id) {
//回显 //回显
this.form = JSON.parse(JSON.stringify(this.controlWindows.addInfo)); this.form = JSON.parse(JSON.stringify(this.controlWindows.addInfo));
this.configAutocomplete.echoId = id; this.configAutocomplete.echoId = id;
this.configAutocomplete.echoName = this.form.refineryName; this.configAutocomplete.echoName = this.form.refineryName;
this.form.salePrice = this.form.salePrice2company this.form.salePrice = this.form.salePrice2company;
this.form.productId = this.form.id this.form.productId = this.form.id;
delete this.form.id // delete this.form.id;
this.rowCreate = true this.rowCreate = true;
this.productChange() this.productChange();
} else {
console.log("this.form", this.form); this.rowCreate = false;
}else{
this.rowCreate = false
} }
}, },
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;
},
productChange() {
this.productData();
},
//搜索产品
async productData() {
let data = {
refineryId: this.form.refineryId,
productType: this.form.productType,
enableMark: "ENABLE",
};
await serve.getRefineryProductList(data).then((res) => {
if (res.data.length > 0) {
this.productNameList = res.data;
} else {
this.productNameList = [];
this.form.productId = "";
}
});
// this.form.productId = this.productNameList[0].productId
},
//搜索客户
customData(value) {
if (value) {
serve.getRefineryCompanyList({ name: value }).then((res) => {
this.customList = res.data;
});
}
},
submit() { submit() {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
this.form.productMeasurement = this.productRowData[0].measurement this.form.productMeasurement = this.productRowData[0].measurement;
this.judgeInterface(this.form).then((res) => { this.judgeInterface(this.form).then((res) => {
if (res.code === 20000) { if (res.code === 20000) {
this.$message.success(res.msg); this.$message.success(res.msg);
@@ -268,16 +258,16 @@ 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 // else
return serve.orderSave(form); return serve.orderSave(form);
}, },
closeWindow() { closeWindow() {
this.$emit("closeWindow"); this.$emit("closeWindow");
this.form = {}; this.form = {};
this.customList = [] this.customList = [];
this.controlWindows.addInfo = {}; this.controlWindows.addInfo = {};
this.configAutocomplete = {} // this.configAutocomplete = {};
this.productNameList = [] this.productNameList = [];
this.$refs.form.clearValidate(); this.$refs.form.clearValidate();
this.controlWindows.create = false; this.controlWindows.create = false;
}, },

View File

@@ -15,8 +15,8 @@
<el-option <el-option
v-for="(item, index) in productTypeList" v-for="(item, index) in productTypeList"
:key="index" :key="index"
:label="item.label" :label="item"
:value="item.value" :value="item"
> >
</el-option> </el-option>
</el-select> </el-select>
@@ -257,28 +257,11 @@ export default {
batch: false, batch: false,
adjust: false, adjust: false,
}, },
productTypeList: [ productTypeList: ["0#柴", "-10#柴", "92#汽", "95#汽"],
{
label: "0#柴",
value: "0#",
},
{
label: "-10#柴",
value: "-10#",
},
{
label: "92#汽",
value: "92#",
},
{
label: "95#汽",
value: "95#",
},
],
configAutocomplete: { configAutocomplete: {
serveTarget: serve.findByEntity, serveTarget: refineryInfoServe.findByEntity,
autocompleteKey: "refineryName", autocompleteKey: "refineryName",
valueKey: "refineryName", labelKey: "refineryName",
valueKey: "id", valueKey: "id",
placeholder: "炼厂名称", placeholder: "炼厂名称",
querykey: "refineryId", querykey: "refineryId",