新增采购模块
This commit is contained in:
parent
888d04812d
commit
d59bc58de1
|
|
@ -0,0 +1,41 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询采购订单物流列表
|
||||
export function listPurchaseOrderShip(query) {
|
||||
return request({
|
||||
url: '/erp-api/scm/purchase/shipList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询采购订单物流详细
|
||||
export function getPurchaseOrderShip(id) {
|
||||
return request({
|
||||
url: '/erp-api/scm/purchase/shipDetail/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
//创建入库单
|
||||
export function createStockInEntry(data) {
|
||||
return request({
|
||||
url: '/erp-api/scm/purchase/ship/createStockInEntry',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 修改采购订单物流
|
||||
export function confirmReceipt(data) {
|
||||
return request({
|
||||
url: '/erp-api/scm/purchase/ship/confirmReceipt',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询物流公司列表
|
||||
export function listLogistics(query) {
|
||||
return request({
|
||||
url: '/erp-api/scm/logistics/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询物流公司详细
|
||||
export function getLogistics(id) {
|
||||
return request({
|
||||
url: '/api/logistics/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增物流公司
|
||||
export function addLogistics(data) {
|
||||
return request({
|
||||
url: '/api/logistics',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改物流公司
|
||||
export function updateLogistics(data) {
|
||||
return request({
|
||||
url: '/api/logistics',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除物流公司
|
||||
export function delLogistics(id) {
|
||||
return request({
|
||||
url: '/api/logistics/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询采购订单列表
|
||||
export function listPurchaseOrder(query) {
|
||||
return request({
|
||||
url: '/erp/purchase/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询采购订单详细
|
||||
export function getPurchaseOrder(id) {
|
||||
return request({
|
||||
url: '/erp-api/scm/purchase/detail/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增采购订单
|
||||
export function addPurchaseOrder(data) {
|
||||
return request({
|
||||
url: '/erp-api/scm/purchase/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改采购订单
|
||||
export function updatePurchaseOrder(data) {
|
||||
return request({
|
||||
url: '/erp-api/scm/purchase/updateStatus',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除采购订单
|
||||
export function delPurchaseOrder(id) {
|
||||
return request({
|
||||
url: '/purchase/purchaseOrder/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询采购订单费用确认列表
|
||||
export function listPurchaseOrderCost(query) {
|
||||
return request({
|
||||
url: '/purchase/purchaseOrderCost/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询采购订单费用确认详细
|
||||
export function getPurchaseOrderCost(id) {
|
||||
return request({
|
||||
url: '/purchase/purchaseOrderCost/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增采购订单费用确认
|
||||
export function addPurchaseOrderCost(data) {
|
||||
return request({
|
||||
url: '/purchase/purchaseOrderCost',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改采购订单费用确认
|
||||
export function updatePurchaseOrderCost(data) {
|
||||
return request({
|
||||
url: '/purchase/purchaseOrderCost',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除采购订单费用确认
|
||||
export function delPurchaseOrderCost(id) {
|
||||
return request({
|
||||
url: '/purchase/purchaseOrderCost/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询采购订单明细列表
|
||||
export function listPurchaseOrderItem(query) {
|
||||
return request({
|
||||
url: '/purchase/purchaseOrderItem/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询采购订单明细详细
|
||||
export function getPurchaseOrderItem(id) {
|
||||
return request({
|
||||
url: '/purchase/purchaseOrderItem/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增采购订单明细
|
||||
export function addPurchaseOrderItem(data) {
|
||||
return request({
|
||||
url: '/purchase/purchaseOrderItem',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改采购订单明细
|
||||
export function updatePurchaseOrderItem(data) {
|
||||
return request({
|
||||
url: '/purchase/purchaseOrderItem',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除采购订单明细
|
||||
export function delPurchaseOrderItem(id) {
|
||||
return request({
|
||||
url: '/purchase/purchaseOrderItem/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,199 @@
|
|||
<template>
|
||||
<el-dialog :visible.sync="dialogVisible" title="选择商品">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="120px">
|
||||
|
||||
<el-form-item label="商品名称" prop="goodsName">
|
||||
<el-input
|
||||
v-model="queryParams.goodsName"
|
||||
placeholder="请输入商品名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品ID" prop="goodsId">
|
||||
<el-input
|
||||
v-model="queryParams.goodsId"
|
||||
placeholder="请输入商品ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="商品编码" prop="goodsNum">
|
||||
<el-input
|
||||
v-model="queryParams.goodsNum"
|
||||
placeholder="请输入商品编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品SKUID" prop="id">
|
||||
<el-input
|
||||
v-model="queryParams.id"
|
||||
placeholder="请输入商品SKUID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="SKU编码" prop="skuCode">
|
||||
<el-input
|
||||
v-model="queryParams.skuCode"
|
||||
placeholder="请输入SKU编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button round icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-if="btn===1"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="sendDataToParent"
|
||||
>确认添加</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-if="btn===2"
|
||||
type="primary"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="sendDataToParent"
|
||||
>确认选中</el-button>
|
||||
</el-col>
|
||||
|
||||
<!-- <right-toolbar showSearch.sync="true" @queryTable="getList"></right-toolbar>-->
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="goodsSpecList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
|
||||
<el-table-column label="规格ID" align="center" prop="id" width="60"/>
|
||||
<el-table-column label="商品ID" align="center" prop="goodsId" width="60"/>
|
||||
<el-table-column label="图片" align="center" prop="colorImage" width="60">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.colorImage" :width="35" :height="35"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" align="left" prop="goodsName" />
|
||||
<el-table-column label="Sku规格" align="center" prop="skuName" >
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-tag size="small" v-if="scope.row.colorValue">{{ scope.row.colorValue }}</el-tag>-->
|
||||
<!-- <el-tag size="small" v-if="scope.row.sizeValue">{{ scope.row.sizeValue }}</el-tag>-->
|
||||
<!-- <el-tag size="small" v-if="scope.row.styleValue">{{ scope.row.styleValue }}</el-tag>-->
|
||||
<!-- </template>-->
|
||||
</el-table-column>
|
||||
<el-table-column label="商品编码" align="center" prop="goodsNum" />
|
||||
<el-table-column label="Sku编码" align="center" prop="skuCode" />
|
||||
<!-- <el-table-column label="尺码" align="center" prop="sizeValue" />-->
|
||||
<!-- <el-table-column label="款式" align="center" prop="styleValue" />-->
|
||||
<!-- <el-table-column label="采购价" align="center" prop="purPrice" />-->
|
||||
<!-- <el-table-column label="零售价" align="center" prop="retailPrice" />-->
|
||||
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
|
||||
<!-- <span>点击按钮向主页面传递数据</span>-->
|
||||
<!-- <el-button @click="sendDataToParent">发送数据</el-button>-->
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import {listGoodsSpec} from "@/api/goods/goodsSpec";
|
||||
|
||||
|
||||
export default {
|
||||
name: 'PopupSkuList',
|
||||
props:{
|
||||
btn:null,//1多选添加2单选
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品规格库存管理表格数据
|
||||
goodsSpecList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
goodsId: null,
|
||||
id: null,
|
||||
goodsNum: null,
|
||||
skuCode: null,
|
||||
merchantId: null,
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 打开弹出框
|
||||
openDialog() {
|
||||
this.getList()
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
// 发送数据到父组件
|
||||
sendDataToParent() {
|
||||
if(!this.ids) {
|
||||
this.$modal.msgError("请选择商品")
|
||||
}
|
||||
const filteredList = this.goodsSpecList.filter(item => this.ids.includes(item.id));
|
||||
console.log("======选中的商品=====",filteredList)
|
||||
const data = { message: 'Hello from Popup!' };
|
||||
this.$emit('data-from-select', filteredList); // 通过自定义事件传递数据
|
||||
this.dialogVisible = false; // 关闭弹出框
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 查询商品规格库存管理列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listGoodsSpec(this.queryParams).then(response => {
|
||||
this.goodsSpecList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,377 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="form" ref="form" size="small" :rules="rules" :inline="true" label-width="98px">
|
||||
<el-form-item label="供应商" prop="contactId">
|
||||
<el-select v-model="form.contactId" filterable placeholder="请选择供应商名称">
|
||||
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="采购日期" prop="orderDate">
|
||||
<el-date-picker clearable v-model="form.orderDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择订单日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-row>
|
||||
<el-form-item label="采购商品:" prop="goodsList">
|
||||
<el-col :span="24">
|
||||
<!-- <el-button size="small" @click="addGoodsDialog"> 添加商品</el-button>-->
|
||||
<el-button size="small" @click="addGoodsDialog1"> 添加商品</el-button>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
|
||||
<el-col :span="24" style="margin-left: 98px;">
|
||||
|
||||
<el-table :data="form.goodsList" style="width: 100%">
|
||||
<el-table-column type="index" label="序号"></el-table-column>
|
||||
<el-table-column prop="id" label="id"></el-table-column>
|
||||
|
||||
<el-table-column prop="colorImage" label="商品图片">
|
||||
<template slot-scope="scope">
|
||||
<el-image style="width: 70px; height: 70px" :src="scope.row.colorImage"></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="goodsName" label="商品名称"></el-table-column>
|
||||
<el-table-column prop="skuCode" label="SKU">
|
||||
</el-table-column>
|
||||
<el-table-column prop="colorValue" label="规格1">
|
||||
</el-table-column>
|
||||
<el-table-column prop="sizeValue" label="规格2">
|
||||
</el-table-column>
|
||||
<el-table-column prop="styleValue" label="规格3">
|
||||
</el-table-column>
|
||||
<el-table-column prop="quantity" label="采购数量">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model.number="scope.row.quantity" placeholder="请输入数量" @input="qtyChange(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="purPrice" label="采购价">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model.number="scope.row.purPrice" placeholder="请输入数量" @input="qtyChange(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-button size="mini" @click="handleEditSku(scope.$index, scope.row)">编辑</el-button>-->
|
||||
<el-button size="mini" type="danger" @click="handleDeleteSku(scope.$index, scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row style="margin-top: 20px;">
|
||||
<el-form-item label="总金额" prop="amount">
|
||||
<el-input type="number" v-model.number="form.orderAmount" placeholder="请输入总金额" />
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm">立即创建</el-button>
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 添加采购商品对话框 -->
|
||||
<!-- <el-dialog title="添加商品" :visible.sync="goodsFormOpen" width="500px" append-to-body :close-on-click-modal="false">-->
|
||||
<!-- <el-form ref="goodsForm" :model="goodsForm" :rules="goodsRules" label-width="80px">-->
|
||||
|
||||
<!-- <el-form-item label="商品" v-if="goodsFormAdd" prop="skuId">-->
|
||||
<!-- <!– <el-input v-model="goodsForm.goodsSpec" placeholder="请输入sku" /> –>-->
|
||||
<!-- <el-select v-model="goodsForm.skuId" filterable remote reserve-keyword placeholder="搜索商品" style="width: 380px;"-->
|
||||
<!-- :remote-method="searchSku" :loading="skuListLoading" @change="skuChanage">-->
|
||||
<!-- <el-option v-for="item in skuList" :key="item.skuId"-->
|
||||
<!-- :label="item.skuCode + ' - ' + item.goodsName + ' - ' + item.colorValue + ' ' + item.sizeValue + ' ' + item.styleValue"-->
|
||||
<!-- :value="item.skuId">-->
|
||||
<!-- </el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="商品图片" >-->
|
||||
<!-- <el-image style="width: 100px; height: 100px" :src="goodsForm.colorImage">-->
|
||||
<!-- </el-image>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="采购价" prop="purPrice">-->
|
||||
<!-- <el-input v-model.number="goodsForm.purPrice" placeholder="" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="数量" prop="qty">-->
|
||||
<!-- <el-input v-model.number="goodsForm.qty" placeholder="请输入数量" @input="qtyChange" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="总金额" prop="amount">-->
|
||||
<!-- <el-input type="number" v-model.number="goodsForm.amount" placeholder="请输入总金额" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-form>-->
|
||||
<!-- <div slot="footer" class="dialog-footer">-->
|
||||
<!-- <el-button type="primary" @click="addGoodsSubmit">确 定</el-button>-->
|
||||
<!-- <el-button @click="addGoodsCancel">取 消</el-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-dialog>-->
|
||||
|
||||
|
||||
<!-- 添加品对话框 -->
|
||||
<PopupSkuList @data-from-select="handleDataFromPopup" :btn="1" ref="popup"></PopupSkuList>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import
|
||||
{ listSupplier } from "@/api/goods/supplier";
|
||||
import { searchSku } from "@/api/goods/goods";
|
||||
import { addPurchaseOrder } from "@/api/purchase/purchaseOrder";
|
||||
import PopupSkuList from '@/views/goods/PopupSkuList.vue'
|
||||
export default {
|
||||
name: "PurchaseOrderCreate",
|
||||
components: { PopupSkuList },
|
||||
data() {
|
||||
return {
|
||||
// 表单参数
|
||||
form: {
|
||||
contactId: null,
|
||||
orderDate: null,
|
||||
goodsList: [],
|
||||
orderAmount:0.00
|
||||
},
|
||||
|
||||
// 表单校验
|
||||
rules: {
|
||||
contactId: [{ required: true, message: '供应商不能为空' }],
|
||||
orderDate: [{ required: true, message: '采购日期不能为空' }],
|
||||
goodsList: [{ required: true, message: '采购商品不能为空' }],
|
||||
},
|
||||
supplierLoading: false,
|
||||
supplierList: [],
|
||||
goodsFormOpen: false,
|
||||
goodsFormAdd: true,
|
||||
goodsForm: {
|
||||
id:null,
|
||||
skuId: null,
|
||||
colorImage: null,
|
||||
goodsName: null,
|
||||
purPrice: null,
|
||||
qty: null,
|
||||
amount: null
|
||||
},
|
||||
goodsRules: {
|
||||
skuId: [{ required: true, message: '请选择商品' }],
|
||||
purPrice: [{ required: true, message: '请选择商品' }],
|
||||
qty: [{ required: true, message: '请填写数量' }, { type: 'number', message: '数量必须为数字值' }],
|
||||
amount: [{ required: true, message: '请填写金额' }, { type: 'number', message: '金额必须为数字值' }],
|
||||
},
|
||||
skuListLoading: false,
|
||||
skuList: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
listSupplier({}).then(response => {
|
||||
this.supplierList = response.rows;
|
||||
// this.supplierLoading = false;
|
||||
});
|
||||
this.form.orderDate = this.getDate()
|
||||
},
|
||||
methods: {
|
||||
getDate() {
|
||||
var now = new Date();
|
||||
var year = now.getFullYear(); //得到年份
|
||||
var month = now.getMonth(); //得到月份
|
||||
var date = now.getDate(); //得到日期
|
||||
var hour = " 00:00:00"; //默认时分秒 如果传给后台的格式为年月日时分秒,就需要加这个,如若不需要,此行可忽略
|
||||
month = month + 1;
|
||||
month = month.toString().padStart(2, "0");
|
||||
date = date.toString().padStart(2, "0");
|
||||
var defaultDate = `${year}-${month}-${date}`;//
|
||||
return defaultDate;
|
||||
},
|
||||
// 搜索SKU
|
||||
searchSku(query) {
|
||||
this.skuListLoading = true;
|
||||
const qw = {
|
||||
keyword: query
|
||||
}
|
||||
searchSku(qw).then(res => {
|
||||
this.skuList = res.rows;
|
||||
this.skuListLoading = false;
|
||||
})
|
||||
},
|
||||
skuChanage(nv) {
|
||||
console.log('=========', nv)
|
||||
const spec = this.skuList.find(x => x.skuId === nv);
|
||||
if (spec) {
|
||||
console.log('=========', spec)
|
||||
|
||||
this.goodsForm.skuId = spec.skuId
|
||||
// this.goodsForm.goodsId = spec.goodsId
|
||||
this.goodsForm.goodsName = spec.goodsName
|
||||
this.goodsForm.colorImage = spec.colorImage
|
||||
this.goodsForm.colorValue = spec.colorValue
|
||||
this.goodsForm.sizeValue = spec.sizeValue
|
||||
this.goodsForm.styleValue = spec.styleValue
|
||||
this.goodsForm.skuCode = spec.skuCode
|
||||
this.goodsForm.skuName = spec.skuName
|
||||
// this.goodsForm.number = spec.number
|
||||
this.goodsForm.purPrice = spec.purPrice
|
||||
}
|
||||
},
|
||||
qtyChange(nv,row) {
|
||||
console.log('======值变化=====', nv,row)
|
||||
// const newItemAmount = nv.quantity * nv.purPrice
|
||||
// this.form.orderAmount += newItemAmount;
|
||||
this.form.orderAmount = 0
|
||||
if (this.form.goodsList && this.form.goodsList.length > 0) {
|
||||
this.form.goodsList.forEach(item => {
|
||||
this.form.orderAmount+= item.quantity*item.purPrice
|
||||
})
|
||||
}
|
||||
},
|
||||
// 搜索供应商
|
||||
searchSupplier(query) {
|
||||
this.supplierLoading = true;
|
||||
const qw = {
|
||||
name: query
|
||||
}
|
||||
listSupplier(qw).then(response => {
|
||||
this.supplierList = response.rows;
|
||||
this.supplierLoading = false;
|
||||
});
|
||||
},
|
||||
addGoodsDialog() {
|
||||
this.goodsForm.skuId = null
|
||||
this.goodsForm.goodsId = null
|
||||
this.goodsForm.goodsName = null
|
||||
this.goodsForm.colorImage = null
|
||||
this.goodsForm.colorValue = null
|
||||
this.goodsForm.number = null
|
||||
this.goodsForm.purPrice = null
|
||||
this.goodsForm.sizeValue = null
|
||||
this.goodsForm.skuCode = null
|
||||
this.goodsForm.styleValue = null
|
||||
this.goodsForm.qty = null
|
||||
this.goodsForm.amount = null
|
||||
this.goodsFormOpen = true
|
||||
},
|
||||
addGoodsDialog1() {
|
||||
|
||||
this.$refs.popup.openDialog();
|
||||
},
|
||||
// 接收子组件传来的数据
|
||||
handleDataFromPopup(data) {
|
||||
console.log('Received data from popup:', data);
|
||||
if(data){
|
||||
data.forEach((item) => {
|
||||
const find = this.form.goodsList.find(x => x.id === item.id)
|
||||
if (!find) {
|
||||
this.form.goodsList.push(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let goodsAmount = 0;
|
||||
this.form.goodsList.forEach(item => {
|
||||
if(!item.quantity) item.quantity= 1
|
||||
item.itemAmount = item.quantity*item.retailPrice
|
||||
goodsAmount+= item.itemAmount
|
||||
if(!item.isGift) item.isGift = '0'
|
||||
})
|
||||
console.log('====添加后=====',this.form.goodsList)
|
||||
this.form.orderAmount = goodsAmount
|
||||
},
|
||||
addGoodsCancel() {
|
||||
this.goodsForm.skuId = null
|
||||
this.goodsForm.goodsId = null
|
||||
this.goodsForm.goodsName = null
|
||||
this.goodsForm.colorImage = null
|
||||
this.goodsForm.colorValue = null
|
||||
this.goodsForm.number = null
|
||||
this.goodsForm.purPrice = null
|
||||
this.goodsForm.sizeValue = null
|
||||
this.goodsForm.skuCode = null
|
||||
this.goodsForm.styleValue = null
|
||||
this.goodsForm.qty = null
|
||||
this.goodsForm.amount = null
|
||||
|
||||
this.goodsFormOpen = false
|
||||
},
|
||||
addGoodsSubmit() {
|
||||
this.$refs["goodsForm"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.goodsFormAdd) {
|
||||
// 添加
|
||||
const isValueExist = this.form.goodsList.find(item => item.id === this.goodsForm.id) !== undefined;
|
||||
if (isValueExist) {
|
||||
this.$message.error("该商品已存在")
|
||||
} else {
|
||||
const a = {
|
||||
... this.goodsForm
|
||||
}
|
||||
this.form.goodsList.push(a)
|
||||
this.form.orderAmount = parseFloat(this.form.orderAmount) + parseFloat(a.amount)
|
||||
this.$message.success("添加成功")
|
||||
}
|
||||
}else{
|
||||
// 修改
|
||||
const a = this.form.goodsList.find(item => item.id === this.goodsForm.id)
|
||||
this.form.orderAmount = parseFloat(this.form.orderAmount) - parseFloat(a.amount) + parseFloat(this.goodsForm.amount)
|
||||
a.qty = this.goodsForm.qty
|
||||
a.amount = this.goodsForm.amount
|
||||
|
||||
|
||||
}
|
||||
this.goodsFormAdd = true
|
||||
this.goodsFormOpen = false
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
handleEditSku(index, row) {
|
||||
this.goodsForm.skuId = row.skuId
|
||||
this.goodsForm.goodsId = row.goodsId
|
||||
this.goodsForm.goodsName = row.goodsName
|
||||
this.goodsForm.colorImage = row.colorImage
|
||||
this.goodsForm.colorValue = row.colorValue
|
||||
this.goodsForm.number = row.number
|
||||
this.goodsForm.purPrice = row.purPrice
|
||||
this.goodsForm.sizeValue = row.sizeValue
|
||||
this.goodsForm.skuCode = row.skuCode
|
||||
this.goodsForm.styleValue = row.styleValue
|
||||
this.goodsForm.qty = row.qty
|
||||
this.goodsForm.amount = row.amount
|
||||
this.goodsFormAdd = false
|
||||
this.goodsFormOpen = true
|
||||
},
|
||||
handleDeleteSku(index, row) {
|
||||
this.form.goodsList.splice(index, 1);
|
||||
this.form.orderAmount = 0
|
||||
if (this.form.goodsList && this.form.goodsList.length > 0) {
|
||||
this.form.goodsList.forEach(item => {
|
||||
this.form.orderAmount+= item.quantity*item.purPrice
|
||||
})
|
||||
}
|
||||
},
|
||||
cancel() {
|
||||
// 调用全局挂载的方法,关闭当前标签页
|
||||
this.$store.dispatch("tagsView/delView", this.$route);
|
||||
this.$router.push('/purchase/order');
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
console.log('======创建采购单=====',this.form)
|
||||
addPurchaseOrder(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.form.contactId = null;
|
||||
this.form.orderAmount= null
|
||||
this.form.orderDate = null
|
||||
this.form.goodsList = []
|
||||
// 调用全局挂载的方法,关闭当前标签页
|
||||
this.$store.dispatch("tagsView/delView", this.$route);
|
||||
this.$router.push('/purchase/order');
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="form" ref="form" size="small" :rules="rules" :inline="true" label-width="128px">
|
||||
<el-form-item label="采购单号" >
|
||||
<el-input v-model="form.orderNum" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="采购日期" prop="orderDate">
|
||||
<el-date-picker clearable v-model="form.orderDate" disabled type="date" value-format="yyyy-MM-dd" placeholder="请选择订单日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商" prop="supplier">
|
||||
<el-input v-model="form.supplier" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="总金额" >
|
||||
<el-input v-model="form.orderAmount" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="审核人" >
|
||||
<el-input v-model="form.auditUser" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="审核时间" >
|
||||
<el-input v-model="form.auditTime" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="采购单确认日期">
|
||||
<el-date-picker clearable v-model="form.supplierConfirmTime" disabled type="date" value-format="yyyy-MM-dd" placeholder="请选择订单日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商发货日期">
|
||||
<el-date-picker clearable v-model="form.supplierDeliveryTime" disabled type="date" value-format="yyyy-MM-dd" placeholder="">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="采购单创建时间">
|
||||
<el-date-picker clearable v-model="form.createTime" disabled type="date" value-format="yyyy-MM-dd" placeholder="">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" >
|
||||
<el-input v-model="form.createBy" disabled />
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-form-item label="商品明细:" prop="goodsList">
|
||||
<el-col :span="24">
|
||||
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
|
||||
<el-col :span="24" style="margin-left: 98px;">
|
||||
|
||||
<el-table :data="itemList" style="width: 100%">
|
||||
<el-table-column type="index" label="序号">
|
||||
</el-table-column>
|
||||
<el-table-column prop="colorImage" label="商品图片">
|
||||
<template slot-scope="scope">
|
||||
<el-image style="width: 70px; height: 70px" :src="scope.row.colorImage"></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="goodsName" label="商品名称"></el-table-column>
|
||||
<el-table-column prop="specNum" label="SKU">
|
||||
</el-table-column>
|
||||
<el-table-column prop="colorValue" label="颜色">
|
||||
</el-table-column>
|
||||
<el-table-column prop="sizeValue" label="尺码">
|
||||
</el-table-column>
|
||||
<el-table-column prop="styleValue" label="款式">
|
||||
</el-table-column>
|
||||
<el-table-column prop="quantity" label="采购数量">
|
||||
</el-table-column>
|
||||
<el-table-column prop="amount" label="总金额">
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row style="margin-top: 20px;">
|
||||
<el-form-item label="总金额" prop="amount">
|
||||
<el-input type="number" v-model.number="form.orderAmount" disabled placeholder="请输入总金额" />
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {getPurchaseOrder} from "@/api/purchase/purchaseOrder";
|
||||
|
||||
export default {
|
||||
name: "PurchaseOrderDetail",
|
||||
data() {
|
||||
return {
|
||||
form:{
|
||||
id:null
|
||||
},
|
||||
itemList:[],
|
||||
rules:{
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
this.form.id = this.$route.query.id
|
||||
this.getDetail()
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
dateToString(timespan){
|
||||
var date = new Date(timespan * 1000);
|
||||
return date.toLocaleString();
|
||||
},
|
||||
getDetail(){
|
||||
getPurchaseOrder(this.form.id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.form.auditTime = this.dateToString(response.data.auditTime * 1000)
|
||||
this.itemList = response.data.itemList
|
||||
console.log('采购单详情',this.form)
|
||||
});
|
||||
// listPurchaseOrderItem({orderId:this.form.id}).then(res =>{
|
||||
// this.itemList = res.rows
|
||||
// console.log('采购单明细',res)
|
||||
// })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,517 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="供应商" prop="supplierId">
|
||||
<el-select
|
||||
v-model="queryParams.supplierId"
|
||||
filterable
|
||||
placeholder="请选择供应商">
|
||||
<el-option
|
||||
v-for="item in supplierList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<!-- <el-input
|
||||
v-model="queryParams.contactId"
|
||||
placeholder="请输入供应商id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="采购单号" prop="orderNum">
|
||||
<el-input
|
||||
v-model="queryParams.orderNum"
|
||||
placeholder="请输入采购单号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="下单日期" prop="orderDate">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.orderDate"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择下单日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
|
||||
>创建采购订单</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="warning"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-download"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- @click="handleExport"-->
|
||||
<!-- v-hasPermi="['purchase:purchaseOrder:export']"-->
|
||||
<!-- >导出</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="purchaseOrderList" @selection-change="handleSelectionChange">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="供应商" align="center" prop="supplierId" >
|
||||
<template slot-scope="scope">
|
||||
<span>{{ supplierList.find(x=>x.id == scope.row.supplierId)?supplierList.find(x=>x.id == scope.row.supplierId).name :'' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单号" align="center" prop="orderNum" />
|
||||
<el-table-column label="下单日期" align="center" prop="orderDate" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.orderDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="总金额" align="center" prop="orderAmount" />
|
||||
<el-table-column label="审核人" align="center" prop="auditUser" />
|
||||
<el-table-column label="审核时间" align="center" prop="auditTime" >
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.auditTime ==0 ? '' : dateToString(scope.row.auditTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="状态" align="center" prop="status" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="info" v-if="scope.row.status === 0">待审核</el-tag>
|
||||
<el-tag type="success" v-if="scope.row.status === 1">已审核</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.status === 101">已确认待供应商发货</el-tag>
|
||||
<el-tag v-if="scope.row.status === 102">供应商已发货</el-tag>
|
||||
<el-tag type="primary" v-if="scope.row.status === 2">已收货</el-tag>
|
||||
<el-tag type="primary" v-if="scope.row.status === 3">已入库</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column label="供应商发货时间" align="center" prop="supplierDeliveryTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.supplierDeliveryTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="收货时间" align="center" prop="receivedTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.receivedTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="入库时间" align="center" prop="stockInTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.stockInTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-col :span="24">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@click="handleDetail(scope.row)"
|
||||
>详情</el-button>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-button
|
||||
v-if="scope.row.status === 0"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-circle-check"
|
||||
@click="handleUpdateStatus(scope.row,'audit')"
|
||||
|
||||
>审核</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="24">-->
|
||||
<!-- <el-button-->
|
||||
<!-- v-if="scope.row.status === 1"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-finished"-->
|
||||
<!-- @click="handleUpdateStatus(scope.row,'confirm')"-->
|
||||
<!-- v-hasPermi="['purchase:purchaseOrder:edit']"-->
|
||||
<!-- >采购确认</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="24">
|
||||
<el-button
|
||||
v-if="scope.row.status === 1"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-finished"
|
||||
@click="handleUpdateStatus(scope.row,'SupplierShip')"
|
||||
|
||||
>供应商发货</el-button>
|
||||
</el-col>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改采购订单对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="138px">
|
||||
|
||||
<el-form-item label="单号" prop="orderNum">
|
||||
<el-input v-model="form.orderNum" disabled placeholder="请输入单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="订单日期" prop="orderDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.orderDate"
|
||||
type="date"
|
||||
disabled
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择订单日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单创建时间" prop="orderTime">
|
||||
<el-input v-model="form.orderTime" disabled placeholder="请输入订单创建时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="订单总金额" prop="orderAmount">
|
||||
<el-input v-model="form.orderAmount" disabled placeholder="请输入订单总金额" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="采购单审核人" prop="auditUser">
|
||||
<el-input v-model="form.auditUser" placeholder="请输入采购单审核人" :disabled=" form.optionType !== 'audit' " />
|
||||
</el-form-item>
|
||||
<el-form-item label="审核时间" prop="auditTime" v-if="form.optionType !== 'audit'">
|
||||
<el-input v-model="form.auditTime" placeholder="请输入审核时间" :disabled=" form.optionType !== 'audit' " />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="供应商发货时间" prop="supplierDeliveryTime" v-if="form.optionType === 'SupplierShip'">
|
||||
<el-date-picker clearable
|
||||
v-model="form.supplierDeliveryTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择供应商发货时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="物流公司" v-if="form.optionType === 'SupplierShip'">
|
||||
<!-- <el-input v-model="form.shipCompany" placeholder="请输入物流公司" />-->
|
||||
<el-select v-model="form.shipCompany" filterable r placeholder="选择快递公司" >
|
||||
<el-option v-for="item in logisticsList" :key="item.id" :label="item.name" :value="item.name">
|
||||
<span style="float: left">{{ item.name }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" >{{item.number}}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="物流单号" v-if="form.optionType === 'SupplierShip'">
|
||||
<el-input v-model="form.shipNo" placeholder="请输入物流公司" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物流费用" v-if="form.optionType === 'SupplierShip'">
|
||||
<el-input type="number" v-model.number="form.shipCost" placeholder="请输入物流费用" />
|
||||
</el-form-item>
|
||||
<el-form-item label="采购金额(不含运费)" v-if="form.optionType === 'confirm'">
|
||||
<el-input type="number" v-model.number="form.totalAmount" placeholder="请输入采购金额(不含运费)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="采购单确认人" v-if="form.optionType === 'confirm'">
|
||||
<el-input v-model="form.confirmUser" placeholder="请输入采购单确认人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listPurchaseOrder, getPurchaseOrder, delPurchaseOrder, addPurchaseOrder, updatePurchaseOrder } from "@/api/purchase/purchaseOrder";
|
||||
import { listSupplier} from "@/api/goods/supplier";
|
||||
import { listLogistics } from "@/api/purchase/logistics";
|
||||
import userInfo from '@/views/system/user/profile/userInfo.vue'
|
||||
import { getUserProfile } from '@/api/system/user'
|
||||
export default {
|
||||
name: "PurchaseOrder",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 采购订单表格数据
|
||||
purchaseOrderList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
contactId: null,
|
||||
orderNo: null,
|
||||
orderDate: null,
|
||||
orderTime: null,
|
||||
orderAmount: null,
|
||||
status: null,
|
||||
auditUser: null,
|
||||
auditTime: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
id:null,
|
||||
orderNo:null,
|
||||
optionType:null,
|
||||
auditUser:null,
|
||||
remark:null,
|
||||
orderAmount:null,
|
||||
shipCost:0.0,
|
||||
supplierDeliveryTime:null,
|
||||
totalAmount:null
|
||||
},
|
||||
|
||||
// 表单校验
|
||||
rules: {
|
||||
},
|
||||
supplierLoading:false,
|
||||
supplierList:[],
|
||||
logisticsList:[],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
listSupplier({}).then(response => {
|
||||
this.supplierList = response.rows;
|
||||
// this.supplierLoading = false;
|
||||
this.getList();
|
||||
});
|
||||
getUserProfile().then(resp=>{
|
||||
this.form.auditUser = resp.data.nickName
|
||||
})
|
||||
|
||||
},
|
||||
methods: {
|
||||
amountChange(nv){
|
||||
this.form.totalAmount = parseFloat(this.form.orderAmount)+parseFloat(this.form.shipCost)
|
||||
},
|
||||
dateToString(timespan){
|
||||
var date = new Date(timespan * 1000);
|
||||
return date.toLocaleString();
|
||||
},
|
||||
// searchSupplier(query){
|
||||
// this.supplierLoading = true;
|
||||
// const qw = {
|
||||
// name:query
|
||||
// }
|
||||
// listSupplier(qw).then(response => {
|
||||
// this.supplierList = response.rows;
|
||||
// this.supplierLoading = false;
|
||||
// });
|
||||
// },
|
||||
/** 查询采购订单列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listPurchaseOrder(this.queryParams).then(response => {
|
||||
this.purchaseOrderList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 详情
|
||||
handleDetail(row){
|
||||
// this.$router.push('/scm/purchase/order/detail',{id:row.id});
|
||||
this.$router.push({path :"/purchase/order/detail", query: { id: row.id }});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
contactId: null,
|
||||
orderNo: null,
|
||||
orderDate: null,
|
||||
orderTime: null,
|
||||
orderAmount: null,
|
||||
remark: null,
|
||||
status: null,
|
||||
auditUser: null,
|
||||
auditTime: null,
|
||||
supplierConfirmTime: null,
|
||||
supplierDeliveryTime: null,
|
||||
receivedTime: null,
|
||||
stockInTime: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.$router.push('/purchase/order/create');
|
||||
},
|
||||
handleUpdateStatus(row,optionType){
|
||||
this.form.id = row.id
|
||||
this.form.orderNum = row.orderNum
|
||||
this.form.orderDate = row.orderDate
|
||||
var date = new Date(row.orderTime * 1000);
|
||||
this.form.orderTime = date.toLocaleString();
|
||||
this.form.orderAmount = row.orderAmount
|
||||
this.form.remark = row.remark
|
||||
|
||||
// this.form.auditUser = row.auditUser
|
||||
this.form.auditTime = this.dateToString(row.auditTime)
|
||||
|
||||
|
||||
|
||||
if ('audit' === optionType){
|
||||
this.form.optionType = 'audit'
|
||||
this.title = "审核采购订单";
|
||||
this.open = true;
|
||||
}else if (optionType === 'SupplierShip'){
|
||||
this.form.optionType = 'SupplierShip'
|
||||
listLogistics({}).then(resp=>{
|
||||
this.logisticsList = resp.rows
|
||||
this.title = "供应商发货";
|
||||
this.form.supplierDeliveryTime = new Date()
|
||||
this.form.shipCost = 0.0
|
||||
this.open = true;
|
||||
})
|
||||
|
||||
}
|
||||
else if (optionType === 'confirm'){
|
||||
this.form.optionType = 'confirm'
|
||||
this.form.totalAmount = row.orderAmount
|
||||
this.title = "采购确认";
|
||||
this.open = true;
|
||||
}
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if(this.form.optionType === 'audit'){
|
||||
if(!this.form.auditUser){
|
||||
this.$message.error("请填写审核人")
|
||||
return
|
||||
}
|
||||
}else if(this.form.optionType === 'SupplierShip'){
|
||||
if(!this.form.supplierDeliveryTime){
|
||||
this.$message.error("请填写供应商发货日期")
|
||||
return
|
||||
}
|
||||
if(!this.form.shipCompany){
|
||||
this.$message.error("请填写供应商发货物流公司")
|
||||
return
|
||||
}
|
||||
if(!this.form.shipNo){
|
||||
this.$message.error("请填写供应商发货物流单号")
|
||||
return
|
||||
}
|
||||
if(this.form.shipCost === null || this.form.shipCost === undefined){
|
||||
this.$message.error("请填写供应商发货物流费用")
|
||||
return
|
||||
}
|
||||
|
||||
}else if(this.form.optionType === 'confirm'){
|
||||
if(!this.form.totalAmount){
|
||||
this.$message.error("请填写采购实际金额")
|
||||
return
|
||||
}
|
||||
if(!this.form.confirmUser){
|
||||
this.$message.error("请填写采购单确认人")
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
updatePurchaseOrder(this.form).then(response => {
|
||||
if(this.form.optionType === 'audit'){
|
||||
if(response.code===0){
|
||||
this.$message.error("审核失败!"+ response.msg)
|
||||
}
|
||||
else if(response.code === 200) {
|
||||
this.$modal.msgSuccess("审核成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}else{
|
||||
this.$message.error("失败!"+ response.msg)
|
||||
}
|
||||
}else if(this.form.optionType === 'SupplierShip'){
|
||||
console.log('=====发货结果======',response)
|
||||
if(response.code === 200) {
|
||||
this.$modal.msgSuccess("发货成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}else{
|
||||
this.$message.error("发货失败!"+ response.msg)
|
||||
}
|
||||
}
|
||||
else if(this.form.optionType === 'confirm'){
|
||||
console.log('=====确认结果======',response)
|
||||
if(response.code === 200) {
|
||||
this.$modal.msgSuccess("确认成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}else{
|
||||
this.$message.error("确认失败!"+ response.msg)
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('purchase/purchaseOrder/export', {
|
||||
...this.queryParams
|
||||
}, `purchaseOrder_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,285 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="128px">
|
||||
<el-form-item label="快递公司" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入快递公司"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="快递公司编码" prop="code">
|
||||
<el-input
|
||||
v-model="queryParams.code"
|
||||
placeholder="请输入快递公司编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="dataList" >
|
||||
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
||||
<el-table-column label="id" align="center" prop="id" />
|
||||
<el-table-column label="快递公司" align="center" prop="name" />
|
||||
<el-table-column label="编码" align="center" prop="code" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="状态" align="center" prop="status" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" v-if="scope.row.status === 0 || !scope.row.status"> 未启用</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.status === 1"> 启用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
v-if="scope.row.status === 0 || !scope.row.status"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdateStatus(scope.row)"
|
||||
>开启</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
v-if="scope.row.status === 1"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleUpdateStatus(scope.row)"
|
||||
>关闭</el-button>
|
||||
<el-row>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['shop:shop:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['shop:shop:remove']"
|
||||
>删除</el-button>
|
||||
</el-row>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<!-- 添加或修改店铺对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="快递公司名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入快递公司名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="快递公司编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入快递公司编码" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="描述" prop="remark">
|
||||
<el-input type="textarea" v-model="form.remark" placeholder="请输入描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="form.status" placeholder="请选择状态">
|
||||
<el-option label="启用" value="1"></el-option>
|
||||
<el-option label="禁用" value="0"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listLogistics,
|
||||
updateLogistics,
|
||||
addLogistics,
|
||||
getLogistics,
|
||||
delLogistics, updateStatus
|
||||
} from '@/api/purchase/logistics'
|
||||
import {MessageBox} from "element-ui";
|
||||
import {isRelogin} from "@/utils/request";
|
||||
|
||||
|
||||
export default {
|
||||
name: "PurchaseLogistics",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 店铺表格数据
|
||||
dataList:[],
|
||||
typeList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
apiOpen: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
id:null,
|
||||
code:null,
|
||||
name:null
|
||||
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
platformId:null,
|
||||
shopId:0,
|
||||
logisticsId:0,
|
||||
status:'1'
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [{ required: true, message: "不能为空", trigger: "blur" }],
|
||||
code: [{ required: true, message: "不能为空", trigger: "blur" }],
|
||||
|
||||
status: [{ required: true, message: "不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询店铺列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
||||
listLogistics(this.queryParams).then(response => {
|
||||
this.dataList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除快递公司为"' + ids + '"的数据项?').then(function() {
|
||||
return delLogistics(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
handleUpdateStatus(row){
|
||||
updateStatus({id:row.id,status:row.status}).then(response => {
|
||||
console.log('更新状态====',response)
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
name: null,
|
||||
number: null,
|
||||
remark: null,
|
||||
status: null,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加快递公司";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getLogistics(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.form.status = response.data.status+'';
|
||||
this.open = true;
|
||||
this.title = "修改";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateLogistics(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addLogistics(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,246 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="form"
|
||||
ref="form"
|
||||
size="small"
|
||||
:rules="rules"
|
||||
:inline="true"
|
||||
label-width="128px"
|
||||
>
|
||||
<el-col span="24">
|
||||
<el-form-item label="采购单号">
|
||||
<el-input v-model="form.orderNum" disabled style="width: 220px"/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
|
||||
<el-form-item label="供应商" prop="supplierId">
|
||||
<el-select v-model="form.supplierId" disabled filterable placeholder="请选择供应商名称" style="width: 220px">
|
||||
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col span="24">
|
||||
<el-form-item label="商品总数量"><el-input v-model="ship.orderSpecUnitTotal" disabled style="width: 220px"/> </el-form-item>
|
||||
<el-form-item label="总金额">
|
||||
<el-input v-model="form.orderAmount" disabled style="width: 220px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col span="24">
|
||||
<el-form-item label="采购日期" prop="orderDate" >
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.orderDate"
|
||||
disabled
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择订单日期"
|
||||
style="width: 220px"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="发货日期">
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.supplierDeliveryTime"
|
||||
disabled
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder=""
|
||||
style="width: 220px"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col span="24">
|
||||
<el-form-item label="创建人">
|
||||
<el-input v-model="form.createBy" disabled style="width: 220px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核人">
|
||||
<el-input v-model="form.auditUser" disabled style="width: 220px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-row>
|
||||
<el-form-item label="商品明细:" prop="goodsList">
|
||||
<el-col :span="24"> </el-col>
|
||||
</el-form-item>
|
||||
|
||||
<el-col :span="24" style="margin-left: 128px">
|
||||
<el-table :data="itemList" style="width: 1200px">
|
||||
<el-table-column type="index" label="序号"> </el-table-column>
|
||||
<el-table-column prop="colorImage" label="商品图片">
|
||||
<template slot-scope="scope">
|
||||
<el-image
|
||||
style="width: 70px; height: 70px"
|
||||
:src="scope.row.colorImage"
|
||||
></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="goodsName"
|
||||
label="商品名称"
|
||||
></el-table-column>
|
||||
<el-table-column prop="specNum" label="SKU"> </el-table-column>
|
||||
<el-table-column prop="colorValue" label="规格1"> </el-table-column>
|
||||
<el-table-column prop="sizeValue" label="规格2"> </el-table-column>
|
||||
<el-table-column prop="styleValue" label="规格3"> </el-table-column>
|
||||
<el-table-column prop="price" label="单价"> </el-table-column>
|
||||
<el-table-column prop="quantity" label="数量">
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="inQty" label="需入库数量">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-input v-model.number="scope.row.inQty" placeholder="填写需入库的数量" />-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column prop="amount" label="总金额"> </el-table-column>
|
||||
</el-table>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="margin-top: 20px">
|
||||
<el-form-item label="收货日期" >
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="ship.receiptTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder=""
|
||||
style="width: 220px"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="物流公司"><el-input v-model="ship.shipCompany" style="width: 220px" /> </el-form-item>
|
||||
<el-form-item label="物流单号"><el-input v-model="ship.shipNum" style="width: 220px" /> </el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-form-item label="备注"><el-input v-model="ship.remark" style="width: 220px" /> </el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-form-item label="入库仓库" prop="warehouseId">
|
||||
<el-select v-model="form.warehouseId" filterable placeholder="请选择入库仓库" style="width: 220px">
|
||||
<el-option v-for="item in warehouseList" :key="item.id" :label="item.warehouseName" :value="item.id">
|
||||
<span style="float: left">{{ item.warehouseName }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.warehouseType=='LOCAL'">本地仓</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-else-if="item.warehouseType=='JDYC'">京东云仓</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-else-if="item.warehouseType=='CLOUD'">系统云仓</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-else>未知仓</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-form-item>
|
||||
<el-button type="primary" style="margin-left: 128px;" @click="submitForm">生成采购入库单</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getPurchaseOrderShip,createStockInEntry } from "@/api/purchase/PurchaseOrderShip";
|
||||
import { getPurchaseOrder } from "@/api/purchase/purchaseOrder";
|
||||
import { listSupplier } from '@/api/goods/supplier'
|
||||
import { parseTime } from '@/utils/zhijian'
|
||||
import { listWarehouse } from '@/api/wms/warehouse'
|
||||
|
||||
|
||||
export default {
|
||||
name: "PurchaseOrderShipCreateEntry",
|
||||
data() {
|
||||
return {
|
||||
queryParams:{
|
||||
pageNum: 1,
|
||||
pageSize:50,
|
||||
},
|
||||
form: {
|
||||
id: null,
|
||||
warehouseId:null
|
||||
},
|
||||
ship:{},
|
||||
itemList:[],
|
||||
supplierList: [],
|
||||
warehouseList: [],
|
||||
rules: {
|
||||
warehouseId:[{ required: true, message: '请选择入库的仓库' }],
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
listSupplier({}).then(response => {
|
||||
this.supplierList = response.rows;
|
||||
});
|
||||
listWarehouse(this.queryParams).then(response => {
|
||||
this.warehouseList = response.rows;
|
||||
listMerchantCloudWarehouse({}).then(response => {
|
||||
if(response.code===200){
|
||||
if(response.data){
|
||||
response.data.forEach(item => {
|
||||
this.warehouseList.push({
|
||||
id:item.warehouseId,
|
||||
warehouseName:item.warehouseName,
|
||||
warehouseType:item.warehouseType,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
this.form.id = this.$route.query.id;
|
||||
this.getDetail();
|
||||
this.form.receiptTime = new Date()
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
parseTime,
|
||||
getDetail() {
|
||||
getPurchaseOrder(this.form.id).then((res) => {
|
||||
this.form = res.data;
|
||||
this.itemList = res.data.itemList
|
||||
console.log("采购单详情", res.data);
|
||||
});
|
||||
|
||||
getPurchaseOrderShip(this.form.id).then((response) => {
|
||||
this.ship = response.data;
|
||||
console.log("物流详情", this.ship);
|
||||
});
|
||||
// listPurchaseOrderItem({orderId:this.form.id}).then(res =>{
|
||||
// if(res.rows){
|
||||
// res.rows.forEach(x=>{
|
||||
// const g = {
|
||||
// ...x
|
||||
// }
|
||||
// x.inQty = x.quantity
|
||||
//
|
||||
// })
|
||||
// }
|
||||
// this.itemList = res.rows
|
||||
// console.log('采购单明细',res)
|
||||
// })
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
this.form.goodsList = this.itemList
|
||||
console.log("======创建采购入库单=====", this.form);
|
||||
createStockInEntry(this.form).then(res=>{
|
||||
console.log("====创建入库单api结果====",res)
|
||||
if(res.code === 200){
|
||||
// 调用全局挂载的方法,关闭当前标签页
|
||||
this.$store.dispatch("tagsView/delView", this.$route);
|
||||
this.$router.push('/purchase/purchase_stock_in');
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,416 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="128px"
|
||||
>
|
||||
<el-form-item label="采购单号" prop="orderNo">
|
||||
<el-input
|
||||
v-model="queryParams.orderNo"
|
||||
placeholder="请输入采购单号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商发货时间" prop="shipTime">
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="queryParams.shipTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择运送时间"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleConfirmReceipt"
|
||||
v-hasPermi="['purchase:PurchaseOrderShip:edit']"
|
||||
>确认收货</el-button
|
||||
>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="warning"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-download"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- @click="handleExport"-->
|
||||
<!-- v-hasPermi="['purchase:PurchaseOrderShip:export']"-->
|
||||
<!-- >导出</el-button-->
|
||||
<!-- >-->
|
||||
<!-- </el-col>-->
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="PurchaseOrderShipList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="采购单ID" align="center" prop="id" />
|
||||
<el-table-column label="采购单号" align="center" prop="orderNum" />
|
||||
<!-- <el-table-column label="商品规格数" align="center" prop="orderSpecUnit"/>-->
|
||||
<!-- <el-table-column label="商品数" align="center" prop="orderGoodsUnit"/>-->
|
||||
<el-table-column
|
||||
label="商品总件数"
|
||||
align="center"
|
||||
prop="orderSpecUnitTotal"
|
||||
/>
|
||||
<el-table-column label="发货物流公司" align="center" prop="shipCompany" />
|
||||
<el-table-column label="发货物流单号" align="center" prop="shipNum" />
|
||||
<el-table-column label="运费" align="center" prop="freight" />
|
||||
<el-table-column
|
||||
label="发货时间"
|
||||
align="center"
|
||||
prop="shipTime"
|
||||
width="180"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.shipTime, "{y}-{m}-{d}") }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="info" v-if="scope.row.status === 0">待收货</el-tag>
|
||||
<el-tag type="success" v-if="scope.row.status === 1">已收货</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.status === 2">已入库</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" align="center" prop="remark" />
|
||||
<el-table-column label="退回数量" align="center" prop="backCount" />
|
||||
<el-table-column label="入库数量" align="center" prop="stockInCount" />
|
||||
<el-table-column
|
||||
label="采购下单日期"
|
||||
align="center"
|
||||
prop="orderDate"
|
||||
width="180"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@click="handleDetail(scope.row)"
|
||||
|
||||
>详情</el-button
|
||||
>
|
||||
<!-- <el-button-->
|
||||
<!-- v-if="scope.row.status === 0"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-edit"-->
|
||||
<!-- @click="handleConfirmReceipt(scope.row)"-->
|
||||
|
||||
<!-- >确认收货</el-button-->
|
||||
<!-- >-->
|
||||
<el-button
|
||||
v-if="scope.row.status === 0"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-document-add"
|
||||
@click="handleCreateEntry(scope.row)"
|
||||
|
||||
>入库</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改采购订单物流对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
|
||||
<el-form-item label="采购订单编号" prop="orderNum">
|
||||
<el-input
|
||||
v-model="form.orderNum"
|
||||
disabled
|
||||
placeholder="请输入采购订单编号"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="采购订单日期" prop="orderDate">
|
||||
<el-date-picker
|
||||
clearable
|
||||
disabled
|
||||
v-model="form.orderDate"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择采购订单日期"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="采购订单商品规格数" prop="orderSpecUnit">
|
||||
<el-input
|
||||
v-model="form.orderSpecUnit"
|
||||
disabled
|
||||
placeholder="请输入采购订单商品规格数"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="采购订单商品数" prop="orderGoodsUnit">
|
||||
<el-input
|
||||
v-model="form.orderGoodsUnit"
|
||||
disabled
|
||||
placeholder="请输入采购订单商品数"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="采购订单总件数" prop="orderSpecUnitTotal">
|
||||
<el-input
|
||||
v-model="form.orderSpecUnitTotal"
|
||||
disabled
|
||||
placeholder="请输入采购订单总件数"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物流公司" prop="shipCompany">
|
||||
<el-input
|
||||
v-model="form.shipCompany"
|
||||
disabled
|
||||
placeholder="请输入物流公司"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物流单号" prop="shipNum">
|
||||
<el-input
|
||||
v-model="form.shipNum"
|
||||
disabled
|
||||
placeholder="请输入物流单号"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="运费" prop="freight">
|
||||
<el-input v-model="form.freight" disabled placeholder="请输入运费" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发货时间" prop="shipTime">
|
||||
<el-date-picker
|
||||
clearable
|
||||
disabled
|
||||
v-model="form.shipTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择发货时间"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="收货日期" prop="receiptTime">
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.receiptTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择收货日期"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listPurchaseOrderShip,
|
||||
getPurchaseOrderShip,
|
||||
delPurchaseOrderShip,
|
||||
addPurchaseOrderShip,
|
||||
confirmReceipt,
|
||||
} from "@/api/purchase/PurchaseOrderShip";
|
||||
|
||||
export default {
|
||||
name: "PurchaseOrderShip",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 采购订单物流表格数据
|
||||
PurchaseOrderShipList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
shipCompany: null,
|
||||
shipNo: null,
|
||||
freight: null,
|
||||
shipTime: null,
|
||||
status: null,
|
||||
backCount: null,
|
||||
stockInCount: null,
|
||||
orderDate: null,
|
||||
orderNo: null,
|
||||
orderSpecUnit: null,
|
||||
orderGoodsUnit: null,
|
||||
orderSpecUnitTotal: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
receiptTime: [{ required: true, message: "请选择收货日期" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询采购订单物流列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listPurchaseOrderShip(this.queryParams).then((response) => {
|
||||
this.PurchaseOrderShipList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
shipCompany: null,
|
||||
shipNo: null,
|
||||
freight: null,
|
||||
shipTime: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
status: null,
|
||||
remark: null,
|
||||
backCount: null,
|
||||
stockInCount: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
orderDate: null,
|
||||
orderNo: null,
|
||||
orderSpecUnit: null,
|
||||
orderGoodsUnit: null,
|
||||
orderSpecUnitTotal: null,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.id);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 详情按钮操作 */
|
||||
handleDetail(row) {
|
||||
this.$router.push({path :"/purchase/order/detail", query: { id: row.id }});
|
||||
},
|
||||
handleCreateEntry(row){
|
||||
// this.$router.push("/scm/purchase/ship/create_stock_in_entry", { id: row.id });
|
||||
this.$router.push({path : "/purchase/ship/create_stock_in_entry", query: { id: row.id }})
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleConfirmReceipt(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids;
|
||||
getPurchaseOrderShip(id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.form.receiptTime = new Date()
|
||||
this.open = true;
|
||||
this.title = "确认收货";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
confirmReceipt(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addPurchaseOrderShip(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Loading…
Reference in New Issue