pull/1/head
lixuan 2 years ago
parent 35b9b892a9
commit 0d3a4868f1
  1. 23
      src/api/product.js
  2. 1
      src/store/getters.js
  3. 2
      src/store/modules/user.js
  4. 5
      src/utils/index.js
  5. 2
      src/views/login/index.vue
  6. 60
      src/views/order/components/billOfLading.vue
  7. 51
      src/views/order/index.vue
  8. 214
      src/views/product/components/create.vue
  9. 23
      src/views/product/index.vue

@ -7,7 +7,7 @@ const getByPage = (params) => {
);
};
//炼厂list
const findByEntity = (params = {}) => {
const findByEntity = (params) => {
return request.postJson(
"/oil-refinery/xoilRefineryInfo/findByEntity",
params
@ -17,8 +17,29 @@ const findByEntity = (params = {}) => {
const update = (params) => {
return request.postJson("/oil-refinery/oilRefineryProduct/update", params);
};
// 下单
const orderSave = (params) => {
return request.postJson(
"/oil-refinery/xoilRefineryOrder/save",
params
);
};
//查看企业产品
const getRefineryProductList = (params) => {
return request.postJson(
"/oil-refinery/oilRefineryProduct/getRefineryProductList",
params
);
};
// 搜索客户
const getRefineryCompanyList = (params) => {
return request.postJson("/oil-user/oilCompanyInfo/getLikeByCompanyType", params);
};
export default {
getByPage,
findByEntity,
orderSave,
getRefineryProductList,
getRefineryCompanyList
};

@ -7,6 +7,7 @@ const getters = {
auth: (state) => state.user.auth,
company_type: (state) => state.user.companyType,
company_id: (state) => state.user.companyId,
company_name: (state) => state.user.userCompanyName,
permission_routes: (state) => state.permission.routes,
};
export default getters;

@ -5,6 +5,7 @@ const getDefaultState = () => {
auth: null,
companyType: 0,
companyId: "",
userCompanyName:''
};
};
@ -21,6 +22,7 @@ const mutations = {
//chainParentMark 1:总公司 0:分公司
state.companyType = data.chainParentMark;
state.companyId = data.userCompany;
state.userCompanyName = data.userCompanyName;
},
};

@ -51,3 +51,8 @@ export function isLicensePlate(no) {
);
return instance.test(no);
}
export function typeJudgment(object) {
let res = {}.__proto__.toString.call(object);
return res ? res : "";
}

@ -154,7 +154,7 @@ export default {
});
return;
}
console.log()
localStorage.setItem("customerToken", res.data.accessToken);
this.$router.replace("/");
})

@ -83,7 +83,7 @@
</el-form-item>
</div>
</div>
<div v-show="item.deliveryStatus=='SUBMITED'" style="text-align: right;color: #409EFF;" @click="billAdd(item,index)">我来修改/锁定</div>
<div v-show="item.deliveryStatus=='SUBMITED'" style="text-align: right;color: #409EFF;" @click="billAdd(item,index)">修改信息</div>
<div class="billBottom-body-bottom">
<div>
<el-form-item label="创建时间">
@ -95,7 +95,7 @@
</div>
<div>
<el-button v-show="item.deliveryStatus=='SUBMITED'&&billData.orderInfo.orderStatus=='DELIVERING'&&billData.orderInfo.payStatus!=='REFUNDED'" type="danger" @click="billDelete(item,index)">删除提货单</el-button>
<el-button :disabled="item.deliveryStatus!=='PLATENUM_LOCKED'&&item.deliveryStatus!=='PLATENUM_SUCCESS'" @click="billSubmit(item,index)" :type="orderTagType(item.deliveryStatus).type1">{{orderTagType(item.deliveryStatus).info}}</el-button>
<el-button :effect="orderTagType(item.deliveryStatus).effect" :disabled="item.deliveryStatus!=='SUBMITED'" @click="billAddSave(2,item)" :type="orderTagType(item.deliveryStatus).type1">{{orderTagType(item.deliveryStatus).info}}</el-button>
</div>
</div>
</div>
@ -126,7 +126,7 @@
<el-button type="info" @click="dialogBillAdd = false"> </el-button>
<el-button v-show="!billTitle" type="primary" @click="billAddSave()">确定</el-button>
<el-button v-show="billTitle" type="primary" @click="billAddSave(1)">修改</el-button>
<el-button v-show="billTitle" type="primary" @click="billAddSave(2)">修改并锁定</el-button>
<!-- <el-button v-show="billTitle" type="primary" @click="billAddSave(2)">修改并锁定</el-button> -->
</div>
</el-dialog>
<el-dialog
@ -255,9 +255,9 @@ export default {
},
orderTagType(val){
switch(val){
case 'SUBMITED': return {orderLabel:'订单提交',label:'等待信息',info:'等待信息锁定',type:'warning',type1:'info',orderType:'info'}
case 'PLATENUM_LOCKED': return {orderLabel:'下单中',label:'信息锁定',info:'提货信息确认',type:'info',type1:'success',orderType:'warning'}
case 'PLATENUM_SUCCESS': return {orderLabel:'下单成功',label:'提货中',info:'提货量确认',type:'',type1:'warning',orderType:''}
case 'SUBMITED': return {orderLabel:'订单提交',label:'等待信息',info:'锁定提货信息',type:'warning',type1:'',orderType:'warning',}
case 'PLATENUM_LOCKED': return {orderLabel:'下单中',label:'信息锁定',info:'信息确认',type:'info',type1:'info',orderType:'warning'}
case 'PLATENUM_SUCCESS': return {orderLabel:'下单成功',label:'提货中',info:'提货',type:'',type1:'info',orderType:''}
case 'DELIVERING': return {orderLabel:'提货中',label:'提货中', type: '',orderType:'info'}
case 'COMPLETE': return {orderLabel:'订单完成',label:'提货完成',info:'提货完成',type:'success',type1:'info',orderType:'success'}
case 'CANCELED': return {orderLabel:'订单取消',label:'订单取消',info:'订单取消',type:'info',type1:'dark',orderType:'info'}
@ -272,34 +272,34 @@ export default {
this.dialogBillAdd = true
},
//
billAddSave(e){
this.$refs["form"].validate((valid) => {
if (valid) {
billAddSave(e,item){
if(!e){
this.billAddData.orderId=this.controlWindows.addInfo.id
this.billAddData.productMeasurement=this.controlWindows.addInfo.productMeasurement
order.billSave(this.billAddData).then(res=>{
if(res.code == 20000){
this.billAddData.deliveryStatus = 'SUBMITED'
this.billData.list.push(this.billAddData)
this.billListMeth()
this.$message.success(res.msg)
this.dialogBillAdd = false
}
})
this.$refs["form"].validate((valid) => {
if (valid) {
this.billAddData.orderId=this.controlWindows.addInfo.id
this.billAddData.productMeasurement=this.controlWindows.addInfo.productMeasurement
order.billSave(this.billAddData).then(res=>{
if(res.code == 20000){
this.billAddData.deliveryStatus = 'SUBMITED'
this.billData.list.push(this.billAddData)
this.billListMeth()
this.$message.success(res.msg)
this.dialogBillAdd = false
}
})}})
}else{
delete this.billAddData.productMeasurement
this.billAddData.deliveryStatus = e==2?'PLATENUM_LOCKED':''
order.update(this.billAddData).then(res=>{
if(res.code == 20000){
this.billListMeth()
this.$message.success(res.msg)
this.dialogBillAdd = false
}
this.$confirm('确定锁定提货单?', '提示', { type: 'error' }).then(() => {
this.billAddData = item?JSON.parse(JSON.stringify(item)):{}
this.billAddData.deliveryStatus = e==2?'PLATENUM_LOCKED':''
order.update(this.billAddData).then(res=>{
if(res.code == 20000){
this.billListMeth()
this.$message.success(res.msg)
this.dialogBillAdd = false
}
})
})
}
}
})
},
//
billListMeth(){

@ -1,8 +1,19 @@
<template>
<div class="order">
<div class="frame">
<el-input class="mr20" v-model="parameter.params.customerId" clearable></el-input>
<el-select style="margin-right: 20px;" v-model="parameter.params.id" placeholder="用户名称" clearable>
<el-input class="mr20" v-model="parameter.params.id" placeholder="订单Id" clearable></el-input>
<!-- <autocomplete
class="mr20"
:params="parameter.params"
:config="configAutocomplete"
/> -->
<!-- 炼厂名称 -->
<autocomplete
class="mr20"
:params="parameter.params"
:config="configAutocompleteLc"
/>
<!-- <el-select style="margin-right: 20px;" v-model="parameter.params.id" placeholder="用户名称" clearable>
<el-option
v-for="item in refineryList"
:key="item.id"
@ -28,7 +39,7 @@
:value="item.id"
>
</el-option>
</el-select>
</el-select> -->
<div class="buttons">
<el-button icon="el-icon-search" @click="handleCurrentChange(1)"
>查询</el-button
@ -97,7 +108,7 @@
minWidth="180"
>
<template slot-scope="{ row }">
<span>{{ row.actQuantity?row.actQuantity:'--' }} / {{ row.preQuantity?row.preQuantity:'--' }} </span>
<span>{{ row.actQuantity|toNumberFixed }} / {{ row.preQuantity?row.preQuantity:'--' }} </span>
</template>
</el-table-column>
@ -107,7 +118,7 @@
minWidth="180"
>
<template slot-scope="{ row }">
<span>{{ row.actAmount }} / {{ row.preAmount }} </span>
<span>{{ row.actAmount|toNumberFixed }} / {{ row.preAmount|toNumberFixed }} </span>
</template>
</el-table-column>
<el-table-column label="时间" minWidth="235">
@ -189,10 +200,19 @@
import serve from "api/refineryInfo.js";
import order from "api/order.js";
import generalDetails from "components/generalDetails/index.vue";
import commonServe from "api/common.js";
import billOfLading from "./components/billOfLading.vue";
import autocomplete from "components/autocomplete/index.vue";
import { mapGetters } from "vuex";
export default {
filters:{
toNumberFixed(val){
if(val){
return Number(val).toFixed(2)
}else{return '--'}
}
},
data() {
return {
controlWindows: {
@ -209,6 +229,22 @@ export default {
value: "COMMON",
},
],
configAutocomplete: {
serveTarget: commonServe.getRefineryCompanyList,
autocompleteKey: "name",
labelKey: "name",
valueKey: "id",
placeholder: "企业名称",
querykey: "customerId",
},
configAutocompleteLc: {
serveTarget: serve.findByEntity,
autocompleteKey: "name",
labelKey: "refineryName",
valueKey: "id",
placeholder: "炼厂名称",
querykey: "refineryId",
},
refineryList: [],
tableHeight: 0,
tableData: [],
@ -244,7 +280,8 @@ export default {
},
components: {
generalDetails,
billOfLading
billOfLading,
autocomplete
},
mounted() {
this.$nextTick(() => {
@ -258,7 +295,7 @@ export default {
created() {
this.findByEntity();
this.getByPage();
console.log(localStorage.getItem('companyIdData'),'ssssssssssss')
console.log(this.$store.state.user.companyId,'ssssssssssss')
},
methods: {
payTagType(val){

@ -1,33 +1,38 @@
<template>
<el-drawer
title="创建订单"
direction="rtl"
:title="controlWindows.addInfo.title"
direction="ltr"
size="40%"
:visible="controlWindows.create"
:visible.sync="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-input
maxlength="50"
v-model="form.productName"
placeholder="请输入客户名称"
></el-input>
</el-form-item>
<el-form-item label="炼厂名称" prop="refineryId">
<el-select v-model="form.refineryId" 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 refineryList"
v-for="(item, index) in customList"
:key="index"
:label="item.refineryName"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="炼厂名称" prop="refineryId">
<!-- <el-autocomplete
label
v-model="form.refineryId"
:fetch-suggestions="querySearchAsync"
value-key="refineryName"
value="id"
placeholder="炼厂名称"
></el-autocomplete> -->
<autocomplete :params="form" :config="configAutocomplete" />
</el-form-item>
<el-form-item label="产品类型" prop="productType">
<el-select v-model="form.productType" placeholder="请选择产品类型">
<el-select v-model="form.productType" @change="productChange" placeholder="请选择产品类型">
<el-option
v-for="(item, index) in productTypeList"
:key="index"
@ -36,29 +41,46 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="产品名称" prop="productName">
<el-input
<el-form-item label="产品名称" prop="productId">
<el-select :disabled="rowCreate" v-model="form.productId" @change="productDataList" 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"
v-model="form.productName"
placeholder="请输入产品名称"
></el-input>
></el-input> -->
</el-form-item>
<el-form-item label="销售价" prop="productName">
<el-form-item label="销售价">
<el-input
maxlength="50"
v-model="form.productName"
v-model="form.salePrice"
placeholder="请输入销售价"
disabled
></el-input>
/
</el-form-item>
<el-form-item label="预约提货量" prop="productName">
<el-form-item label="预约提货量">
<el-input
maxlength="50"
v-model="form.productName"
v-model="form.preQuantity"
placeholder="请输入预约提货量"
></el-input>
</el-form-item>
<el-form-item label="订单金额">
<el-input
maxlength="50"
v-model="form.preAmount"
disabled
></el-input>
</el-form-item>
</el-form>
</div>
<div class="buttons">
@ -70,15 +92,59 @@
<script>
import serve from "api/product.js";
import refineryInfoServe from "api/refineryInfo.js";
import autocomplete from "components/autocomplete/index.vue";
export default {
components: {
autocomplete,
},
props: {
controlWindows: Object,
// refineryTypeEnum: Array,
},
watch:{
"form.salePrice": {
handler(n, o) {
if(n){
this.form.preAmount = this.form.salePrice*(this.form.preQuantity?this.form.preQuantity:0)
}
},
},
"form.preQuantity": {
handler(n, o) {
if(n){
this.form.preAmount = this.form.preQuantity*(this.form.salePrice?this.form.salePrice:0)
}
},
}
},
data() {
let validatorRefineryId = (rule, value, callback) => {
if (this.form.refineryId) callback();
else callback("请选择炼厂");
};
return {
form: {},
rowCreate:false,
customList:[],
form: {
preAmount:0
},
productNameList:[],
refineryList: [],
productRowData:{},
configAutocomplete: {
serveTarget: serve.findByEntity,
autocompleteKey: {
key:"refineryName"
},
labelKey: "refineryName",
valueKey: "id",
placeholder: "炼厂名称",
querykey: "refineryId",
echoId: "",
echoName: "",
},
productTypeList: [
{
label: "0#柴",
@ -98,27 +164,96 @@ export default {
},
],
rules: {
productName: [
{ required: true, message: "请输入产品名称", trigger: "blur" },
customerId: [
{ required: true, message: "请输入客户名称", trigger: "blur" },
],
productId: [
{ required: true, message: "请输入产品名称", trigger: "change" },
],
refineryId: [
{ required: true, message: "请选择炼厂", trigger: "blur" },
{ required: true, validator: validatorRefineryId, trigger: "change" },
],
enableMark: [
{ required: true, message: "请选择启用状态", trigger: "blur" },
{ required: true, message: "请选择启用状态", trigger: "change" },
],
productType: [
{ required: true, message: "请选择产品类型", trigger: "blur" },
{ required: true, message: "请选择产品类型", trigger: "change" },
],
},
};
},
created() {},
methods: {
openDrawer() {},
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()
},
//
refineryData(value){
if (value) {
serve.findByEntity({refineryName:value}).then((res) => {
this.refineryList = res.data;
});
this.productData()
}
},
//
productData(){
let data = {
refineryId:this.form.refineryId,
productType:this.form.productType,
enableMark:'ENABLE'
}
serve.getRefineryProductList(data).then((res) => {
if(res.data.length>0){
this.productNameList = res.data;
}else{
this.productNameList = []
this.form.productId = ''
}
})
console.log(this.productRowData,'aaaaaaaaaa')
},
//
customData(value){
if (value) {
serve.getRefineryCompanyList({name:value}).then((res) => {
this.customList = res.data;
this.form.customerId = this.$store.state.user.companyId
console.log(this.form.customerId,'ssssaaaaaaaaaaaaaaa')
});
}
},
openDrawer() {
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
}
},
submit() {
this.$refs["form"].validate((valid) => {
if (valid) {
this.judgeInterface(this.form).then((res) => {
if (res.code === 20000) {
this.$message.success(res.msg);
@ -129,19 +264,15 @@ export default {
});
},
judgeInterface(form) {
let { id } = this.controlWindows.addInfo;
if (id) return serve.update(form);
else return serve.save(form);
},
//list
findByEntity() {
refineryServe.findByEntity().then((res) => {
this.refineryList = res.data;
});
// let { id } = this.controlWindows.addInfo;
// if (id) return serve.update(form);
// else
return serve.orderSave(form);
},
closeWindow() {
this.$emit("closeWindow");
this.form = {};
this.controlWindows.addInfo = {};
this.$refs.form.clearValidate();
this.controlWindows.create = false;
},
@ -154,7 +285,8 @@ export default {
padding: 20px;
.el-input,
.el-select,
.el-textarea {
.el-textarea,
.el-autocomplete {
width: 300px;
}
}

@ -34,7 +34,7 @@
</el-option>
</el-select>
<autocomplete :params="parameter.params" :config="configAutocomplete" />
<el-input
<!-- <el-input
v-model="parameter.params.belongLibrary"
placeholder="所处炼厂库"
clearable
@ -46,7 +46,7 @@
>
<el-option label="启用" value="ENABLE"> </el-option>
<el-option label="禁用" value="DISABLE"> </el-option>
</el-select>
</el-select> -->
<div class="buttons">
<el-button icon="el-icon-search" @click="search">查询</el-button>
@ -109,7 +109,7 @@
<template slot-scope="{ row }">
<span class="el-dropdown-link" @click="detail(row)">详情</span>
<span class="el-dropdown-link">下单</span>
<span class="el-dropdown-link" @click="updateCreate(row)">下单</span>
</template>
</el-table-column>
</el-table>
@ -156,7 +156,6 @@ import generalDetails from "components/generalDetails/index.vue";
export default {
components: {
create,
pagination,
autocomplete,
generalDetails,
@ -188,7 +187,7 @@ export default {
],
configAutocomplete: {
serveTarget: serve.findByEntity,
autocomplateKey: "refineryName",
autocomplateKey: "name",
valueKey: "refineryName",
placeholder: "炼厂名称",
querykey: "refineryId",
@ -244,12 +243,24 @@ export default {
getByPage() {
serve.getByPage(this.parameter).then((res) => {
this.tableData = res.data.list;
this.parameter.total = res.data.totalPage;
this.parameter.total = res.data.totalCount;
});
},
//
createOrder(row) {
this.controlWindows.addInfo = {}
this.controlWindows.addInfo.title = "创建订单";
this.controlWindows.create = true;
console.log(this.controlWindows,'新增')
},
//
updateCreate(row){
this.controlWindows.addInfo = {
title: "创建订单",
...row,
};
this.controlWindows.create = true;
console.log('修改')
},
//
detail(row) {

Loading…
Cancel
Save