Browse Source

供应商供货

dev
wangzhenglan 2 years ago
parent
commit
a93cb5b7ad
  1. 34
      src/api/supplier.js
  2. 2
      src/components/Prouduct/ProuductAdd.vue
  3. 266
      src/components/Supplier/SupplyAdd.vue
  4. 78
      src/components/Supplier/SupplyList.vue
  5. 2
      src/router/index.js

34
src/api/supplier.js

@ -111,4 +111,38 @@ export function selectSupplierList(data) {
method:'get', method:'get',
params:data params:data
}) })
}
export function SureOrder(data){
return axios({
url:'/Supply/SureOrder',
method:'post',
params:data
})
}
export function onAddSupply(data){
return axios({
url:'/Supply/onAddSupply',
method:'post',
params:data
})
}
export function goodsNum() {
return axios({
url: '/Supply/goodsNum',
method: 'get'
})
}
export function supplierNames() {
return axios({
url: '/Supply/supplierNames',
method: 'get'
})
} }

2
src/components/Prouduct/ProuductAdd.vue

@ -57,7 +57,7 @@
<el-row style="padding-right:800px;"> <el-row style="padding-right:800px;">
<el-col span="24"> <el-col span="24">
<el-form-item label="品牌:" prop="brands"> <el-form-item label="产品品牌:" prop="brands">
<el-select v-model="addProuduct.brands" > <el-select v-model="addProuduct.brands" >
<el-option v-for="item in addbrandslist" :key="item.brands" :value="item.brands"></el-option> <el-option v-for="item in addbrandslist" :key="item.brands" :value="item.brands"></el-option>
{{item}} {{item}}

266
src/components/Supplier/SupplyAdd.vue

@ -1,32 +1,39 @@
<template> <template>
<div> <div>
<el-steps :active="active" finish-status="success"> <el-form ref="addSupply" :inline="true" :model="addSupply" :rules="rules" class="demo-form-inline" label-width="100px" title="货物基本信息">
<el-step title="步骤 1"></el-step>
<el-step title="步骤 2"></el-step>
</el-steps>
<el-form ref="addSupplier" :inline="true" :model="addSupplier" :rules="rules" class="demo-form-inline" label-width="100px" title="供应商基本信息" v-if="active==0">
<el-row style="padding-right:100px;" > <el-row style="padding-right:100px;" >
<el-col span="24"> <el-col span="24">
<el-form-item label="供应商编码" prop="supplierNum" > <el-form-item label="货物编码" prop="goodsNum" >
<el-input v-model="addSupplier.supplierNum" disabled ></el-input> <el-input v-model="addSupply.goodsNum" disabled ></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row style="padding-right:100px;"> <el-row style="padding-right:100px;">
<el-col span="24"> <el-col span="24">
<el-form-item label="供应商名称" prop="supplierName"> <el-form-item label="货物名称" prop="goodsName">
<el-input v-model="addSupplier.supplierName" ></el-input> <el-input v-model="addSupply.goodsName" ></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row style="padding-right:100px;">
<el-col span="24">
<el-form-item label="供应商" prop="supplierName">
<el-select v-model="addSupply.supplierName" >
<el-option v-for="item in supplierNames" :key="item.supplierName" :value="item.supplierName"></el-option>
{{item}}
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row style="padding-right:100px;"> <el-row style="padding-right:100px;">
<el-col span="24"> <el-col span="24">
<el-form-item label="供应商品牌" prop="supplierBrands"> <el-form-item label="类型" prop="goodsType">
<el-select v-model="addSupplier.supplierBrands" > <el-select v-model="addSupply.goodsType" >
<el-option v-for="item in addbrandslist" :key="item.brands" :value="item.brands"></el-option> <el-option v-for="item in addtypelist" :key="item.type" :value="item.type"></el-option>
{{item}} {{item}}
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -35,212 +42,140 @@
<el-row style="padding-right:100px;"> <el-row style="padding-right:100px;">
<el-col span="24"> <el-col span="24">
<el-form-item label="供应商联系人" prop="supplierContact"> <el-form-item label="规格" prop="goodsSize">
<el-input v-model="addSupplier.supplierContact" ></el-input> <el-input v-model="addSupply.goodsSize" ></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row style="padding-right:100px;"> <el-row style="padding-right:100px;">
<el-col span="24"> <el-col span="24">
<el-form-item label="联系电话" prop="supplierNumber"> <el-form-item label="价格" prop="goodsPrice">
<el-input v-model="addSupplier.supplierNumber"></el-input> <el-input v-model="addSupply.goodsPrice"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form>
<el-form ref="addSupplier2" :inline="true" :model="addSupplier2" :rules="rules2" class="demo-form-inline" label-width="100px" title="供应商基本信息" v-if="active==1">
<el-row style="padding-right:100px;"> <el-row style="padding-right:100px;">
<el-col span="24"> <el-col span="24">
<el-form-item label="供应商收件人" prop="supplierReceiver"> <el-form-item label="备注" prop="goodsEffect">
<el-input v-model="addSupplier2.supplierReceiver"></el-input> <el-input v-model="addSupply.goodsEffect"></el-input>
</el-form-item> </el-form-item>
</el-col>
</el-row>
<el-row style="padding-right:100px;">
<el-col span="24">
<el-form-item label="供应商邮箱号" prop="supplierEmail">
<el-input v-model="addSupplier2.supplierEmail"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row style="padding-right:100px;">
<el-col span="24">
<el-form-item label="供应商起始日" prop="supplierStartDate">
<el-date-picker v-model="addSupplier2.supplierStartDate" type="date" placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row style="padding-right:100px;"> <el-row style="padding-right:100px;">
<el-col span="24"> <el-col span="24">
<el-form-item label="供应商终止日" prop="supplierTerminationDate"> <el-form-item label="状态" prop="goodsState">
<el-date-picker v-model="addSupplier2.supplierTerminationDate" type="date" placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd"></el-date-picker> <el-select v-model="addSupply.goodsState" >
</el-form-item> <el-option label="是" value='1'></el-option>
</el-col> <el-option label="否" value='0'></el-option>
</el-row> </el-select>
<el-row style="padding-left:85px;"> </el-form-item>
<el-col span="24">
<el-form-item label="供应商地址" prop="supplierAddress">
<el-input v-model="addSupplier2.supplierAddress" style="width:400px"></el-input>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> <el-row style="padding-left:250px">
<el-col span="2">
<el-form-item>
<el-button type="primary" @click="sure">添加</el-button>
<el-button style="margin-top: 12px;" @click="next" v-if="active==0">下一步</el-button> </el-form-item>
<el-button style="margin-top: 12px;" @click="back" v-if="active==1">上一步</el-button> </el-col>
<el-button style="margin-top: 12px;" @click="sure" v-if="active==1">添加</el-button> </el-row>
<el-button style="margin-top: 12px;" @click="keep" v-if="active==2">返回</el-button> </el-form>
</div> </div>
</template> </template>
<script> <script>
import {onAddSupplier} from'@/api/supplier.js' import {onAddSupply} from'@/api/supplier.js'
import {onbrandslist} from '@/api/prouduct.js'
import {ontypelist}from '@/api/prouduct.js' import {ontypelist}from '@/api/prouduct.js'
import {SupplierNum} from '@/api/supplier.js' import {goodsNum,supplierNames} from '@/api/supplier.js'
export default { export default {
data(){ data(){
const sureBrands=(rules,value,callback)=>{ const supplierName=(rules,value,callback)=>{
if(!value){ if(!value){
return callback(new Error('请选择品牌')) return callback(new Error('请选择供应商'))
}else{ }else{
callback(); callback();
} }
}; };
const sureNumber=(rules,value,callback)=>{ const goodsState=(rules2,value,callback)=>{
var checkNumber=/^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/
if(!value){ if(!value){
return callback(new Error('联系电话不能为空')) return callback(new Error('请选择有无货物'))
}else if(checkNumber.test(value)){
return callback()
}else{ }else{
callback(new Error('手机号格式不正确'));
}
};
const sureEmail=(rules2,value,callback)=>{
var checkEmail=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
if(!value){
return callback(new Error('邮箱不能为空'))
}else if(checkEmail.test(value)){
return callback(); return callback();
}else{
callback(new Error('邮箱格式不正确'));
} }
}; };
const sureDate=(rules2,value,callback)=>{ const goodsType=(rules2,value,callback)=>{
if(!value){ if(!value){
return callback(new Error('日期不能为空')) return callback(new Error('请选择品牌'))
}else{ }else{
return callback(); return callback();
} }
}; };
return{ return{
active:0, active:0,
addSupplier:{ addSupply:{
}, goodsNum:0,
addSupplier2:{ goodsName:'',
supplierName:'',
goodsType:'',
goodsSize:'',
goodsPrice:'',
goodsEffect:'',
goodsState:''
}, },
addbrandslist:[],
addchannellist:[],
addtypelist:[], addtypelist:[],
supplierNames:[],
rules:{ rules:{
supplierName:[ goodsName:[
{required:true,message:'产品名称不能为空',trigger:'blur'}, {required:true,message:'货物名称不能为空',trigger:'blur'},
{ min: 3, max: 30, message: '长度在 3 到 30 个字符', trigger: 'blur' } { min: 3, max: 30, message: '长度在 3 到 30 个字符', trigger: 'blur' }
], ],
supplierBrands:[ goodsPrice:[
{required:true,validator:sureBrands,trigger:'change'} {required:true,message:'价格不能为空',trigger:'change'}
], ],
supplierContact:[ goodsSize:[
{ required: true,message:'联系人不能为空', trigger: "change"} { required: true,message:'规格不能为空', trigger: "change"}
], ],
supplierNumber:[ supplierName:[
{required:true,validator:sureNumber, trigger:'blur'} {required:true,validator:supplierName, trigger:'blur'}
]
},
rules2:{
supplierReceiver:[
{required:true,message:'收件人不能为空', trigger:'blur'}
],
supplierEmail:[
{required:true,validator:sureEmail, trigger:'blur'}
],
supplierStartDate:[
{required:true,validator:sureDate, trigger:'blur'}
], ],
supplierTerminationDate:[ goodsType:[
{required:true,validator:sureDate, trigger:'blur'} {required:true,validator:goodsType, trigger:'blur'}
], ],
supplierAddress:[ goodsEffect:[
{required:true,message:'供应商地址不能为空',trigger:'blur'} {required:true,message:'货物效果不能为空',trigger:'blur'}
] ],
} goodsState:[
{required:true,validator:goodsState,trigger:'blur'}
]
},
} }
}, },
methods:{ methods:{
next() {
this.$refs.addSupplier.validate((valid)=>{
if(valid){
if (this.active++ > 2) this.active = 0;
}
})
},
back(){
if (this.active-- > 2) this.active = 0;
},
keep(){
location.reload(true)
},
sure(){ sure(){
let Supplier={} this.$refs.addSupply.validate((valid)=>{
Supplier.supplierNum=this.addSupplier.supplierNum
Supplier.supplierName=this.addSupplier.supplierName
Supplier.supplierBrands=this.addSupplier.supplierBrands
Supplier.supplierContact=this.addSupplier.supplierContact
Supplier.supplierNumber=this.addSupplier.supplierNumber
Supplier.supplierReceiver=this.addSupplier2.supplierReceiver
Supplier.supplierEmail=this.addSupplier2.supplierEmail
Supplier.supplierStartDate=this.addSupplier2.supplierStartDate
Supplier.supplierTerminationDate=this.addSupplier2.supplierTerminationDate
Supplier.supplierAddress=this.addSupplier2.supplierAddress
this.$refs.addSupplier2.validate((valid)=>{
if(valid){ if(valid){
onAddSupplier(Supplier).then((response)=>{ onAddSupply(this.addSupply).then((response)=>{
if(response.code !==200)return this.$message.error("添加失败") if(response.code !==200)return this.$message.error("添加失败")
this.$message.success("添加成功") this.$message.success("添加成功")
this.active=2;
}) })
} }
this.$refs.addSupply.resetFields();
}) })
}, },
//brandslist
onbrandslist(){
onbrandslist().then((response)=>{
// console.log(response)
this.addbrandslist=response.data
})
},
//typelist //typelist
@ -250,13 +185,22 @@ export default {
this.addtypelist=response.data this.addtypelist=response.data
}) })
}, },
//supplierNames
onsupplierNames(){
supplierNames().then((response=>{
console.log(response)
this.supplierNames=response.data
}))
},
// //
SupplierNum(){ goodsNum(){
SupplierNum().then((response)=>{ goodsNum().then((response)=>{
console.log(response) //console.log(response)
this.addSupplier.supplierNum=response.data this.addSupply.goodsNum=response.data
}) })
} }
@ -272,9 +216,11 @@ export default {
created() { created() {
this.onbrandslist();
this.ontypelist(); this.ontypelist();
this.SupplierNum(); this.goodsNum();
this.onsupplierNames();
} }

78
src/components/Supplier/SupplyList.vue

@ -75,16 +75,20 @@
<!-- 定义修改页面 当对话框关闭时,将表格数据重置--> <!-- 定义修改页面 当对话框关闭时,将表格数据重置-->
<el-dialog title="订单信息" :visible.sync="updateDialogVisible" width="50%" @close="closeUpdateDialog"> <el-dialog title="订单信息" :visible.sync="updateDialogVisible" width="50%" @close="closeUpdateDialog">
<!-- 定义用户提交表单数据--> <!-- 定义用户提交表单数据-->
<el-form :model="orderSupply" ref="orderSupply" label-width="100px"> <el-form :model="orderSupply" ref="orderSupply" label-width="100px" :rules="rules" >
<el-form-item label="货物名称" prop="goodsName"> <el-form-item label="货物名称" prop="goodsName">
<!-- // disabled --> <!-- // disabled -->
<el-input v-model="orderSupply.goodsName" disabled style="max-width:220px"></el-input> <el-input v-model="orderSupply.goodsName" disabled style="max-width:220px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="类型" prop="goodsType">
<el-input v-model="orderSupply.goodsType" disabled style="max-width:220px"></el-input>
</el-form-item>
<el-form-item label="价格/元" prop="goodsPrice"> <el-form-item label="价格/元" prop="goodsPrice">
<el-input v-model="orderSupply.goodsPrice" disabled style="max-width:220px"></el-input> <el-input v-model="orderSupply.goodsPrice" disabled style="max-width:220px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="类型" prop="goodsType"> <el-form-item label="件" prop="goodsQut">
<el-input v-model="orderSupply.goodsType" disabled style="max-width:220px"></el-input> <el-input v-model="orderSupply.goodsQty" disabled style="max-width:220px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品总价" prop="totalPrice" > <el-form-item label="商品总价" prop="totalPrice" >
<el-input v-model="orderSupply.totalPrice" disabled style="max-width:220px"></el-input> <el-input v-model="orderSupply.totalPrice" disabled style="max-width:220px"></el-input>
@ -95,12 +99,18 @@
<el-form-item label="发货地址" prop="supplierAddress"> <el-form-item label="发货地址" prop="supplierAddress">
<el-input v-model="orderSupply.supplierList.supplierAddress" disabled style="max-width:220px"></el-input> <el-input v-model="orderSupply.supplierList.supplierAddress" disabled style="max-width:220px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="供应商收件人" prop="supplierReceiver"> <el-form-item label="供应商联系人" prop="supplierContact">
<el-input v-model="orderSupply.supplierList.supplierReceiver" disabled style="max-width:220px"></el-input> <el-input v-model="orderSupply.supplierList.supplierContact" disabled style="max-width:220px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="供应商联系电话" prop="supplierNumber" > <el-form-item label="供应商联系电话" prop="supplierNumber" >
<el-input v-model="orderSupply.supplierList.supplierNumber" disabled style="max-width:220px"></el-input> <el-input v-model="orderSupply.supplierList.supplierNumber" disabled style="max-width:220px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="收货经销商" prop="dealerName" style="padding-right:100px">
<el-select v-model="orderSupply.dealerName" size="small">
<el-option v-for="item in dealerNames" :key="item.dealerName" :value="item.dealerName"></el-option>
{{item}}
</el-select>
</el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -204,20 +214,36 @@ import {toExcel} from '@/api/prouduct.js'
import {onsupply}from '@/api/supplier.js' import {onsupply}from '@/api/supplier.js'
import {goodsTypes} from '@/api/supplier.js' import {goodsTypes} from '@/api/supplier.js'
import {message,confirm} from 'element-ui' import {message,confirm} from 'element-ui'
import {Onorder} from '@/api/supplier.js' import {Onorder,SureOrder} from '@/api/supplier.js'
import {dealerNames} from '@/api/dealer.js'
export default { export default {
data() { data() {
const dealerName=(rules,value,callback)=>{
if(!value){
return callback(new Error('请选择收货经销商'))
}else{
callback();
}
};
return { return {
dealerNames:[],
orderSupply:{ orderSupply:{
goodsName:'', goodsName:'',
goodsPrice:'', goodsPrice:0,
goodsType:'', goodsType:'',
totalPrice:'', goodsQty:0,
totalPrice:0,
goodsSupplier:'', goodsSupplier:'',
supplierList:[] supplierList:{
supplierAddress:'',
supplierContact:'',
supplierNumber:''
},
dealerName:'',
}, },
supplyselect: { supplyselect: {
goodsName:'', goodsName:'',
@ -234,9 +260,14 @@ import {Onorder} from '@/api/supplier.js'
updateDialogVisible:false, updateDialogVisible:false,
DetailsDialogVisible:false, DetailsDialogVisible:false,
addupdateSupplier:{}, addupdateSupplier:{},
DetailsSupplier:{} DetailsSupplier:{},
rules:{
dealerName:[
{required:true,validator:dealerName,trigger:'change'}
]
} }
}
}, },
methods: { methods: {
// //
@ -308,6 +339,9 @@ import {Onorder} from '@/api/supplier.js'
this.goodsTypes=response.data this.goodsTypes=response.data
}) })
}, },
closeUpdateDialog(){ closeUpdateDialog(){
// //
this.$refs.orderSupply.resetFields() this.$refs.orderSupply.resetFields()
@ -328,13 +362,28 @@ import {Onorder} from '@/api/supplier.js'
this.updateDialogVisible=true this.updateDialogVisible=true
Onorder(data).then((response)=>{ Onorder(data).then((response)=>{
this.orderSupply=response.data[0] this.orderSupply=response.data[0]
this.orderSupply.supplierList=response.data[0].supplierList[0] this.orderSupply.goodsQty=100
this.orderSupply.totalPrice=this.orderSupply.goodsPrice*this.orderSupply.goodsQty
this.orderSupply.supplierList=response.data[0].supplierList
}) })
//
dealerNames().then((response)=>{
this.dealerNames=response.data
})
}, },
SureOrder(){
SureOrder(){
this.$refs.orderSupply.validate((valid)=>{
if(valid){
SureOrder(this.orderSupply).then((response)=>{
if(response.code !==200) this.$message.error("下单失败")
this.$message.success("下单成功")
this.updateDialogVisible=false
})
}
})
} }
}, },
@ -342,6 +391,9 @@ import {Onorder} from '@/api/supplier.js'
created() { created() {
this.selectSupplyList(); this.selectSupplyList();
this.goodsTypelist(); this.goodsTypelist();
this.supplierNames();
this.ontypelist();
this.goodsNum();
} }
} }
</script> </script>

2
src/router/index.js

@ -81,11 +81,9 @@ const routes = [
// component: () => import(/* webpackChunkName: "about" */ '../views/Text.vue') // component: () => import(/* webpackChunkName: "about" */ '../views/Text.vue')
// } // }
] ]
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'history',
base: process.env.BASE_URL, base: process.env.BASE_URL,
routes routes
}) })
export default router export default router

Loading…
Cancel
Save