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',
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-col span="24">
<el-form-item label="品牌:" prop="brands">
<el-form-item label="产品品牌:" prop="brands">
<el-select v-model="addProuduct.brands" >
<el-option v-for="item in addbrandslist" :key="item.brands" :value="item.brands"></el-option>
{{item}}

266
src/components/Supplier/SupplyAdd.vue

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

2
src/router/index.js

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

Loading…
Cancel
Save