源文件

This commit is contained in:
gyq
2024-04-24 09:52:04 +08:00
commit 127202beac
386 changed files with 102573 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
<template>
<el-dialog :title="`${form.id ? '编辑' : '添加'}供应商`" :visible.sync="dialogVisible" @close="reset">
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
<el-form-item label="供应商" prop="purveyorName">
<el-input v-model="form.purveyorName" placeholder="请输入供应商名称"></el-input>
</el-form-item>
<el-form-item label="联系电话">
<el-input v-model="form.purveyorTelephone" placeholder="请输入联系电话"></el-input>
</el-form-item>
<el-form-item label="地址">
<el-input type="textarea" v-model="form.address" placeholder="请输入地址"></el-input>
</el-form-item>
<el-form-item label="标签">
<el-input v-model="form.tip" placeholder="请输入标签"></el-input>
</el-form-item>
<el-form-item label="备注">
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="onSubmitHandle"> </el-button>
</span>
</el-dialog>
</template>
<script>
import { tbShopPurveyor } from '@/api/invoicing'
export default {
data() {
return {
dialogVisible: false,
form: {
id: '',
purveyorName: '',
purveyorTelephone: '',
address: '',
tip: '',
remark: '',
},
rules: {
purveyorName: [
{
required: true,
message: '请输入供应商名称',
trigger: 'blur'
}
]
}
}
},
methods: {
onSubmitHandle() {
this.$refs.form.validate(async valid => {
if (valid) {
try {
let res = await tbShopPurveyor({
...this.form,
shopId: localStorage.getItem('shopId')
}, this.form.id ? 'put' : 'post')
this.$emit('success', res)
this.close()
this.$notify({
title: '成功',
message: `${this.form.id ? '编辑' : '添加'}成功`,
type: 'success'
});
} catch (error) {
console.log(error)
}
}
})
},
show(obj) {
this.dialogVisible = true
if (obj && obj.id) {
this.form = JSON.parse(JSON.stringify(obj))
}
},
close() {
this.dialogVisible = false
},
reset() {
this.form.id = ''
this.form.purveyorName = ''
this.form.purveyorTelephone = ''
this.form.address = ''
this.form.tip = ''
this.form.remark = ''
}
}
}
</script>

View File

@@ -0,0 +1,178 @@
<!-- 进销存详情记录 -->
<template>
<el-dialog title="详情记录" width="80%" :visible.sync="dialogVisible" @close="dialogVisible = false">
<div class="head-container">
<el-select v-model="query.type" placeholder="选择类型">
<el-option :label="item.label" :value="item.value" v-for="item in typeList" :key="item.id"></el-option>
</el-select>
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</div>
<div class="head-container">
<div class="exchange_wrap">
<div class="item">
<span>{{ exchange || 0 }}</span>
<span>变动数量</span>
</div>
</div>
</div>
<div class="head-container">
<el-table :data="tableData.list" v-loading="tableData.loading">
<el-table-column label="变动数量" prop="stockNumber">
<template v-slot="scope">
<span class="num" :class="{ active: scope.row.stockNumber > 0 }">{{ scope.row.stockNumber }} {{
scope.row.unitName
}}</span>
</template>
</el-table-column>
<el-table-column label="类型">
<template v-slot="scope">
<el-tag type="info">{{ scope.row.tagName }}</el-tag>
</template>
</el-table-column>
<el-table-column label="剩余库存">
<template v-slot="scope">
{{ scope.row.leftNumber - scope.row.stockNumber }} {{ scope.row.unitName }}
</template>
</el-table-column>
<el-table-column label="操作时间" prop="updatedAt">
<template v-slot="scope">
{{ dayjs(scope.row.updatedAt).format('YYYY-MM-DD HH:mm:ss') }}
</template>
</el-table-column>
</el-table>
</div>
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</el-dialog>
</template>
<script>
import dayjs from 'dayjs'
import { dictDetail, tbProductStockDetail, tbProductStockDetailSum } from '@/api/invoicing'
export default {
data() {
return {
dayjs,
dialogVisible: false,
typeList: [],
query: {
type: '',
createdAt: []
},
goods: '',
tableData: {
page: 0,
size: 10,
total: 0,
sort: 'id',
loading: false,
list: []
},
exchange: 0
}
},
methods: {
async getTableData() {
this.tableData.loading = true
try {
const res = await tbProductStockDetail({
page: this.tableData.page,
size: this.tableData.size,
sort: this.tableData.sort,
shopId: localStorage.getItem('shopId'),
productId: this.goods.id,
type: this.query.type,
createdAt: this.query.createdAt
})
this.tableData.loading = false
this.tableData.list = res.content.map(item => {
item.tagName = this.typeList.find(val => val.value == item.type).label
return item
})
console.log(this.tableData.list)
this.tableData.total = res.totalElements
} catch (error) {
console.log(error);
}
},
// 分页回调
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
},
// 重置查询
resetHandle() {
this.query.blurry = ''
this.tableData.page = 0
this.tableData.list = []
this.getTableData()
},
async show(obj) {
this.dialogVisible = true
this.goods = obj
this.tbProductStockDetailSum()
await this.dictDetail()
await this.getTableData()
},
async tbProductStockDetailSum() {
try {
const { exchange } = await tbProductStockDetailSum({
productId: this.goods.id
})
this.exchange = exchange
} catch (error) {
console.log(error);
}
},
async dictDetail() {
try {
const res = await dictDetail({
dictName: 'product_stock_type',
page: 0,
size: 100
})
this.typeList = res.content
} catch (error) {
console.log(error)
}
}
}
}
</script>
<style scoped lang="scss">
.head-container {
display: flex;
align-items: center;
gap: 10px;
}
.num {
color: #67C23A;
&.active {
color: #F56C6C;
}
}
.exchange_wrap {
display: flex;
padding: 20px 30px;
.item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
span:nth-child(1) {
padding-bottom: 10px;
font-size: 24px;
}
}
}
</style>

View File

@@ -0,0 +1,66 @@
<template>
<el-dialog title="详情" width="80%" :visible.sync="dialogVisible" @close="dialogVisible = false">
<div class="head-container">
<span>{{ tableData.detail.type == 'reject' ? '退货出库' : '供应商入库' }}</span>
</div>
<div class="head-container">
<el-table :data="tableData.detail.stockSnap" v-loading="tableData.loading" height="400px">
<el-table-column :label="`商品名称${tableData.detail.stockSnap.length}`" prop="name"></el-table-column>
<el-table-column label="变动数量" prop="number">
<template v-slot="scope">
{{ scope.row.number }}{{ scope.row.unitName }}
</template>
</el-table-column>
</el-table>
</div>
<div class="head-container">
<div class="row">备注{{ tableData.detail.remark }}</div>
<div class="row">操作人{{ tableData.detail.operatorSnap.name }}</div>
<div class="row">创建时间{{ tableData.detail.createdAt }}</div>
</div>
</el-dialog>
</template>
<script>
import dayjs from 'dayjs'
import { tbProductStockOperateDetail } from '@/api/invoicing'
export default {
data() {
return {
dayjs,
dialogVisible: false,
tableData: {
loading: false,
detail: {
stockSnap: [],
operatorSnap: {
name: ''
}
}
}
}
},
methods: {
show(id) {
this.dialogVisible = true
this.getTableData(id)
},
async getTableData(id) {
this.tableData.loading = true
try {
const res = await tbProductStockOperateDetail(id)
this.tableData.loading = false
this.tableData.detail = res
} catch (error) {
console.log(error);
}
}
}
}
</script>
<style scoped lang="scss">
.row {
padding-bottom: 10px;
}
</style>

View File

@@ -0,0 +1,151 @@
<template>
<div class="app-container">
<div class="head-container">
<el-row :gutter="20">
<el-col :span="6">
<el-input v-model="query.name" size="small" clearable placeholder="商品名称" style="width: 100%;"
class="filter-item" @keyup.enter.native="getTableData" />
</el-col>
<el-col :span="6">
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</el-col>
</el-row>
</div>
<div class="head-container">
<el-table :data="tableData.list" v-loading="tableData.loading">
<el-table-column label="商品信息">
<template v-slot="scope">
<div class="shop_info">
<el-image :src="scope.row.coverImg" class="cover">
<div class="img_error" slot="error">
<i class="icon el-icon-document-delete"></i>
</div>
</el-image>
<div class="info">
<span>{{ scope.row.name }}</span>
<div>
<el-tag type="primary">{{ scope.row.typeEnum | typeEnum }}</el-tag>
</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="库存" prop="stockNumber">
<template v-slot="scope">
{{ `${scope.row.stockNumber} ${scope.row.unitName}` }}
</template>
</el-table-column>
<el-table-column label="库存开关">
<template v-slot="scope">
<el-switch v-model="scope.row.isStock" :active-value="1" :inactive-value="0"></el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template v-slot="scope">
<el-button type="text" size="mini"
@click="$refs.invoicingDetail.show(scope.row)">库存记录</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="head-container">
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
<invoicingDetail ref="invoicingDetail" />
</div>
</template>
<script>
import { tbProductGet } from '@/api/invoicing'
import settings from '@/settings'
import invoicingDetail from './components/invoicingDetail'
export default {
components: {
invoicingDetail
},
data() {
return {
query: {
name: ''
},
tableData: {
page: 0,
size: 10,
total: 0,
sort: 'id',
loading: false,
list: []
}
}
},
filters: {
typeEnum(m) {
return settings.typeEnum.find(item => item.typeEnum == m).label
}
},
mounted() {
this.getTableData()
},
methods: {
async getTableData() {
this.tableData.loading = true
try {
const res = await tbProductGet({
page: this.tableData.page,
size: this.tableData.size,
sort: this.tableData.sort,
name: this.query.name,
shopId: localStorage.getItem('shopId')
})
this.tableData.loading = false
this.tableData.list = res.content.map(item => {
let stockNumber = 0
for (let i of item.skuList) {
stockNumber += i.stockNumber
}
item.stockNumber = stockNumber
return item
})
this.tableData.total = res.totalElements
} catch (error) {
console.log(error);
}
},
// 分页回调
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
},
// 重置查询
resetHandle() {
this.query.blurry = ''
this.tableData.page = 0;
this.getTableData()
}
}
}
</script>
<style scoped lang="scss">
.shop_info {
display: flex;
align-items: center;
.cover {
$size: 50px;
width: $size;
height: $size;
border-radius: 2px;
background-color: #efefef;
}
.info {
display: flex;
flex-direction: column;
padding-left: 10px;
justify-content: space-between;
}
}
</style>

View File

@@ -0,0 +1,110 @@
<template>
<div class="app-container">
<div class="head-container">
<div class="filter_wrap">
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" @change="getTableData">
</el-date-picker>
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</div>
</div>
<div class="head-container">
<el-table :data="tableData.list" v-loading="tableData.loading">
<el-table-column label="类型" prop="type">
<template v-slot="scope">
{{ scope.row.type == 'reject' ? '退货出库' : '供应商入库' }}
</template>
</el-table-column>
<el-table-column label="商品数量" prop="totalAmount">
<template v-slot="scope">
{{ scope.row.stockSnap.length }}
</template>
</el-table-column>
<el-table-column label="备注" prop="remark"></el-table-column>
<el-table-column label="操作人" prop="status">
<template v-slot="scope">
{{ scope.row.operatorSnap.account }}
</template>
</el-table-column>
<el-table-column label="创建时间" prop="updatedAt">
<template v-slot="scope">
{{ dayjs(scope.row.stockTime).format('YYYY-MM-DD HH:mm:ss') }}
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template v-slot="scope">
<el-button type="text" size="mini" @click="$refs.operatingDetail.show(scope.row.id)">
详情
</el-button>
<!-- <el-button type="text" size="mini" @click="$refs.operatingDetail.show(scope.row.id)">
作废
</el-button> -->
</template>
</el-table-column>
</el-table>
</div>
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
<operatingDetail ref="operatingDetail" />
</div>
</template>
<script>
import dayjs from 'dayjs'
import { tbProductStockOperateList } from '@/api/invoicing'
import operatingDetail from './components/operatingDetail'
export default {
components: {
operatingDetail
},
data() {
return {
dayjs,
query: {
createdAt: []
},
tableData: {
page: 0,
size: 10,
total: 0,
sort: 'id',
loading: false,
list: []
}
}
},
mounted() {
this.getTableData()
},
methods: {
async getTableData() {
this.tableData.loading = true
try {
const res = await tbProductStockOperateList({
page: this.tableData.page,
size: this.tableData.size,
shopId: localStorage.getItem('shopId'),
createdAt: this.query.createdAt
})
this.tableData.loading = false
this.tableData.list = res.content
this.tableData.total = res.totalElements
} catch (error) {
console.log(error);
}
},
// 重置查询
resetHandle() {
this.query.createdAt = []
this.tableData.page = 0;
this.getTableData()
},
// 分页回调
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
}
}
}
</script>

View File

@@ -0,0 +1,276 @@
<template>
<div class="app-container">
<div class="head-container">
<el-form ref="queryForm" :model="queryForm" :rules="queryRules" label-position="left" label-width="80px">
<el-form-item label="出库类型">
<div class="shop_type_box">
<div class="item" v-for="(item, index) in shopTypes" :key="index"
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
<div class="s_title">{{ item.label }}</div>
<div class="active_dot">
<i class="el-icon-check"></i>
</div>
</div>
</div>
</el-form-item>
<el-row>
<el-col :span="8" v-if="shopTypes[shopTypesActive].value == 'purveyor'">
<el-form-item label="供应商" prop="purveyorId">
<el-select v-model="queryForm.purveyorId" placeholder="请选择供应商" style="width: 220px;">
<el-option :label="item.purveyorName" :value="item.id" v-for="item in purveyorList"
:key="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="入库时间" prop="time">
<el-date-picker v-model="queryForm.time" type="date" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 220px;">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="shopTypes[shopTypesActive].value == 'purveyor'">
<el-col :span="8">
<el-form-item label="应收金额">
<el-input v-model="queryForm.totalAmount" placeholder="请输入应收金额"
style="width: 220px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="实收金额">
<el-input v-model="queryForm.paidAmount" placeholder="请输入实收金额"
style="width: 220px;"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="shopTypes[shopTypesActive].value == 'purveyor'">
<el-col :span="8">
<el-form-item label="付款时间">
<el-date-picker v-model="queryForm.paidAt" type="date" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 220px;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="批号">
<el-input v-model="queryForm.batchNumber" placeholder="请输入批号"
style="width: 220px;"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="备注">
<el-input v-model="queryForm.remark" placeholder="请输入备注" style="width: 220px;"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" @click="$refs.shopList.show(tableData.list)">选择商品</el-button>
</el-form-item>
</el-form>
</div>
<div class="head-container">
<el-button type="primary" plain>
{{ tableData.list.length }}种商品金额合计<span style="color: red;">{{ queryForm.totalAmount }}</span>
</el-button>
</div>
<div class="head-container">
<el-table :data="tableData.list">
<el-table-column type="index" width="50"></el-table-column>
<el-table-column label="商品名称" prop="name">
<template v-slot="scope">
<div class="name_wrap">
<span class="name">{{ scope.row.name }}</span>
<el-tag type="info" v-if="scope.row.specSnap" size="mini">{{ scope.row.specSnap }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="进价">
<template v-slot="scope">
<el-input-number v-model="scope.row.guidePrice" :min="0" controls-position="right"
@change="e => scope.row.totalAmount = e * scope.row.number"></el-input-number>
<div class="tips">成本价{{ scope.row.costPrice }}/{{ scope.row.unitName }}</div>
</template>
</el-table-column>
<el-table-column label="数量">
<template v-slot="scope">
<el-input-number v-model="scope.row.number" :min="0" controls-position="right"
@change="e => scope.row.totalAmount = e * scope.row.guidePrice"></el-input-number>
<div class="tips">入库前{{ scope.row.stockNumber }}{{ scope.row.unitName }}</div>
</template>
</el-table-column>
<el-table-column label="小计">
<template v-slot="scope">
<el-input-number v-model="scope.row.totalAmount" :min="0"
controls-position="right"></el-input-number>
</template>
</el-table-column>
<el-table-column label="变动后剩余库存">
<template v-slot="scope">
{{ scope.row.stockNumber + scope.row.number }}{{ scope.row.unitName }}
</template>
</el-table-column>
<el-table-column label="操作" width="80">
<template v-slot="scope">
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div>
<el-button type="primary" @click="submitHandle" :loading="queryFormLoading">确定</el-button>
</div>
<shopList ref="shopList" @success="selectShop" />
<el-dialog :visible.sync="showResult" :show-close="false" :close-on-press-escape="false"
:close-on-click-modal="false">
<el-result icon="success" title="入库提交成功" :subTitle="`共操作${tableData.list.length}件商品`">
<template slot="extra">
<el-button type="primary" size="medium" @click="resetHandle">创建新的入库单</el-button>
<router-link to="/invoicing/operating_record">
<el-button size="medium">历史提交</el-button>
</router-link>
</template>
</el-result>
</el-dialog>
</div>
</template>
<script>
import dayjs from 'dayjs'
import shopList from '@/components/shopList'
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn } from '@/api/invoicing'
export default {
components: {
shopList
},
data() {
return {
shopTypesActive: 0,
shopTypes: [
{
label: '供应商入库',
value: 'purveyor'
},
{
label: '其他入库',
value: 'purchase'
}
],
resetForm: '',
queryFormLoading: false,
queryForm: {
batchNumber: '',
list: [],
paidAmount: 0,
paidAt: '',
purveyorId: '',
purveyorName: '',
remark: '',
time: dayjs().format('YYYY-MM-DD'),
totalAmount: 0,
type: 'purveyor',
shopId: localStorage.getItem('shopId')
},
queryRules: {
purveyorId: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
time: [
{
required: true,
message: ' ',
trigger: 'change'
}
]
},
purveyorList: [],
tableData: {
list: []
},
showResult: false
}
},
mounted() {
this.resetForm = { ...this.queryForm }
this.tbShopPurveyorGet()
},
methods: {
// 提交
submitHandle() {
this.$refs.queryForm.validate(async valid => {
if (valid) {
try {
this.queryFormLoading = true
this.queryForm.list = this.tableData.list
await tbProductStockOperateOutAndOn(this.queryForm)
this.queryFormLoading = false
this.showResult = true
} catch (error) {
console.log(error)
this.queryFormLoading = false
}
}
})
},
// 选择商品
selectShop(res) {
let arr = []
res.forEach(item => {
item.skuList.forEach(i => {
arr.push({
name: item.name,
unitName: item.unitName,
productId: item.id,
number: 0,
totalAmount: '',
...i
})
})
})
console.log(arr)
this.tableData.list = arr
},
// 初始化
resetHandle() {
this.showResult = false
this.queryForm = { ...this.resetForm }
this.tableData.list = []
},
// 切换类型
changeTypeEnum(index) {
this.shopTypesActive = index
this.queryForm.type = this.shopTypes[index].value
},
// 获取供应商列表
async tbShopPurveyorGet() {
try {
const res = await tbShopPurveyorGet({
shopId: localStorage.getItem('shopId'),
page: 0,
size: 100
})
this.purveyorList = res.content
} catch (error) {
console.log(error)
}
}
}
}
</script>
<style scoped lang="scss">
.name_wrap {
display: flex;
align-items: center;
.name {
margin-right: 10px;
}
}
</style>

View File

@@ -0,0 +1,274 @@
<template>
<div class="app-container">
<div class="head-container">
<el-form ref="queryForm" :model="queryForm" :rules="queryRules" label-position="left" label-width="80px">
<el-form-item label="出库类型">
<div class="shop_type_box">
<div class="item" v-for="(item, index) in shopTypes" :key="index"
:class="{ active: shopTypesActive == index }" @click="changeTypeEnum(index)">
<div class="s_title">{{ item.label }}</div>
<div class="active_dot">
<i class="el-icon-check"></i>
</div>
</div>
</div>
</el-form-item>
<el-row>
<el-col :span="8" v-if="shopTypes[shopTypesActive].value == 'reject'">
<el-form-item label="供应商" prop="purveyorId">
<el-select v-model="queryForm.purveyorId" placeholder="请选择供应商" style="width: 220px;">
<el-option :label="item.purveyorName" :value="item.id" v-for="item in purveyorList"
:key="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="出库时间" prop="time">
<el-date-picker v-model="queryForm.time" type="date" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 220px;">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="shopTypes[shopTypesActive].value == 'reject'">
<el-col :span="8">
<el-form-item label="应收金额">
<el-input v-model="queryForm.totalAmount" placeholder="请输入应收金额"
style="width: 220px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="实收金额">
<el-input v-model="queryForm.paidAmount" placeholder="请输入实收金额" style="width: 220px;"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="shopTypes[shopTypesActive].value == 'reject'">
<el-col :span="8">
<el-form-item label="付款时间">
<el-date-picker v-model="queryForm.paidAt" type="date" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 220px;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="批号">
<el-input v-model="queryForm.batchNumber" placeholder="请输入批号" style="width: 220px;"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="备注">
<el-input v-model="queryForm.remark" placeholder="请输入备注" style="width: 220px;"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" @click="$refs.shopList.show(tableData.list)">选择商品</el-button>
</el-form-item>
</el-form>
</div>
<div class="head-container">
<el-button type="primary" plain>
{{ tableData.list.length }}种商品金额合计<span style="color: red;">{{ queryForm.totalAmount }}</span>
</el-button>
</div>
<div class="head-container">
<el-table :data="tableData.list">
<el-table-column type="index" width="50"></el-table-column>
<el-table-column label="商品名称" prop="name">
<template v-slot="scope">
<div class="name_wrap">
<span class="name">{{ scope.row.name }}</span>
<el-tag type="info" v-if="scope.row.specSnap" size="mini">{{ scope.row.specSnap }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="进价">
<template v-slot="scope">
<el-input-number v-model="scope.row.guidePrice" :min="0" controls-position="right"
@change="e => scope.row.totalAmount = e * scope.row.number"></el-input-number>
<div class="tips">成本价{{ scope.row.costPrice }}/{{ scope.row.unitName }}</div>
</template>
</el-table-column>
<el-table-column label="数量">
<template v-slot="scope">
<el-input-number v-model="scope.row.number" :min="0" controls-position="right"
@change="e => scope.row.totalAmount = e * scope.row.guidePrice"></el-input-number>
<div class="tips">出库前{{ scope.row.stockNumber }}{{ scope.row.unitName }}</div>
</template>
</el-table-column>
<el-table-column label="小计">
<template v-slot="scope">
<el-input-number v-model="scope.row.totalAmount" :min="0"
controls-position="right"></el-input-number>
</template>
</el-table-column>
<el-table-column label="变动后剩余库存">
<template v-slot="scope">
{{ scope.row.stockNumber - scope.row.number }}{{ scope.row.unitName }}
</template>
</el-table-column>
<el-table-column label="操作" width="80">
<template v-slot="scope">
<el-button type="text" @click="tableData.list.splice(scope.$index, 1)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div>
<el-button type="primary" @click="submitHandle" :loading="queryFormLoading">确定</el-button>
</div>
<shopList ref="shopList" @success="selectShop" />
<el-dialog :visible.sync="showResult" :show-close="false" :close-on-press-escape="false"
:close-on-click-modal="false">
<el-result icon="success" title="出库提交成功" :subTitle="`共操作${tableData.list.length}件商品`">
<template slot="extra">
<el-button type="primary" size="medium" @click="resetHandle">创建新的出库单</el-button>
<router-link to="/invoicing/operating_record">
<el-button size="medium">历史提交</el-button>
</router-link>
</template>
</el-result>
</el-dialog>
</div>
</template>
<script>
import dayjs from 'dayjs'
import shopList from '@/components/shopList'
import { tbShopPurveyorGet, tbProductStockOperateOutAndOn } from '@/api/invoicing'
export default {
components: {
shopList
},
data() {
return {
shopTypesActive: 0,
shopTypes: [
{
label: '供应商退货',
value: 'reject'
},
{
label: '其他出库',
value: 'other-out'
}
],
resetForm: '',
queryFormLoading: false,
queryForm: {
batchNumber: '',
list: [],
paidAmount: 0,
paidAt: '',
purveyorId: '',
purveyorName: '',
remark: '',
time: dayjs().format('YYYY-MM-DD'),
totalAmount: 0,
type: 'reject',
shopId: localStorage.getItem('shopId')
},
queryRules: {
purveyorId: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
time: [
{
required: true,
message: ' ',
trigger: 'change'
}
]
},
purveyorList: [],
tableData: {
list: []
},
showResult: false
}
},
mounted() {
this.resetForm = { ...this.queryForm }
this.tbShopPurveyorGet()
},
methods: {
// 提交
submitHandle() {
this.$refs.queryForm.validate(async valid => {
if (valid) {
try {
this.queryFormLoading = true
this.queryForm.list = this.tableData.list
await tbProductStockOperateOutAndOn(this.queryForm)
this.queryFormLoading = false
this.showResult = true
} catch (error) {
console.log(error)
this.queryFormLoading = false
}
}
})
},
// 选择商品
selectShop(res) {
let arr = []
res.forEach(item => {
item.skuList.forEach(i => {
arr.push({
name: item.name,
unitName: item.unitName,
productId: item.id,
number: 0,
totalAmount: '',
...i
})
})
})
console.log(arr)
this.tableData.list = arr
},
// 初始化
resetHandle() {
this.showResult = false
this.queryForm = { ...this.resetForm }
this.tableData.list = []
},
// 切换类型
changeTypeEnum(index) {
this.shopTypesActive = index
this.queryForm.type = this.shopTypes[index].value
},
// 获取供应商列表
async tbShopPurveyorGet() {
try {
const res = await tbShopPurveyorGet({
shopId: localStorage.getItem('shopId'),
page: 0,
size: 100
})
this.purveyorList = res.content
} catch (error) {
console.log(error)
}
}
}
}
</script>
<style scoped lang="scss">
.name_wrap {
display: flex;
align-items: center;
.name {
margin-right: 10px;
}
}
</style>

View File

@@ -0,0 +1,136 @@
<template>
<div class="app-container">
<div class="head-container">
<div class="filter_wrap">
<el-input v-model="query.name" clearable placeholder="供应商" @keyup.enter.native="getTableData"
style="width: 200px;" />
<el-select v-model="query.type" placeholder="付款状态">
<el-option :label="item.label" :value="item.value" v-for="item in types" :key="item.id"></el-option>
</el-select>
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</div>
</div>
<div class="head-container">
<el-table :data="tableData.list" v-loading="tableData.loading">
<el-table-column label="供应商" prop="purveyorName"></el-table-column>
<el-table-column label="剩余付款金额" prop="waitAmount">
<template v-slot="scope">
<span class="num" v-if="scope.row.waitAmount > 0">{{ scope.row.waitAmount }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="待付款笔数" prop="waitCount">
<template v-slot="scope">
<template v-if="scope.row.waitCount > 0">
<span class="count">{{ scope.row.waitCount }}</span>未付
</template>
<template v-else>-</template>
</template>
</el-table-column>
<el-table-column label="状态" prop="type">
<template v-slot="scope">
<el-tag :type="scope.row.type == 0 ? 'warning' : 'success'">
{{ scope.row.type == 0 ? '待支付' : '已完结' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="上笔进货日期" prop="lastTransactAt">
<template v-slot="scope">
{{ dayjs(scope.row.lastTransactAt).format('YYYY-MM-DD HH:mm:ss') }}
</template>
</el-table-column>
<el-table-column label="操作" width="80">
<template v-slot="scope">
<router-link :to="{ name: 'purchase_detail', query: { purveyorId: scope.row.purveyorId } }">
<el-button type="text" size="mini">查看详情</el-button>
</router-link>
</template>
</el-table-column>
</el-table>
</div>
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
</template>
<script>
import dayjs from 'dayjs'
import { tbShopPurveyorTransactGet, dictDetail } from '@/api/invoicing'
export default {
data() {
return {
dayjs,
types: [],
query: {
name: '',
type: ''
},
tableData: {
page: 0,
size: 10,
total: 0,
sort: 'id',
loading: false,
list: []
}
}
},
mounted() {
this.dictDetail()
this.getTableData()
},
methods: {
async getTableData() {
this.tableData.loading = true
try {
const res = await tbShopPurveyorTransactGet({
page: this.tableData.page,
size: this.tableData.size,
sort: this.tableData.sort,
purveyorName: this.query.name,
status: this.query.type,
type: 'purveyor',
shopId: localStorage.getItem('shopId')
})
this.tableData.loading = false
this.tableData.list = res.content
this.tableData.total = res.totalElements
} catch (error) {
console.log(error);
}
},
// 重置查询
resetHandle() {
this.query.name = ''
this.query.type = ''
this.tableData.page = 0;
this.getTableData()
},
// 分页回调
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
},
async dictDetail() {
const { content } = await dictDetail({
dictName: 'purveyor_transact_status',
size: 100,
page: 0
})
this.types = content
}
}
}
</script>
<style scoped lang="scss">
.num {
color: #F56C6C;
font-weight: bold;
}
.count {
color: #409EFF;
}
</style>

View File

@@ -0,0 +1,350 @@
<template>
<div class="app-container">
<div class="head-container">
<el-radio-group v-model="query.time" @change="timeChange">
<el-radio-button :label="item.value" v-for="item in timeList" :key="item.label">{{ item.label
}}</el-radio-button>
</el-radio-group>
</div>
<div class="head-container" v-if="query.time == 'custom'">
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" @change="getTableData">
</el-date-picker>
</div>
<div class="head-container">
<div class="filter_wrap">
<el-select v-model="query.type" placeholder="付款状态">
<el-option :label="item.label" :value="item.value" v-for="item in types" :key="item.id"></el-option>
</el-select>
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</div>
</div>
<div class="head-container">
<div class="info_list">
<div class="item">
<div class="icon_wrap" style="background-color: #F2D7FF;">
<i class="icon el-icon-info" style="color:#C978EE;"></i>
</div>
<div class="info">
<div class="n">{{ info.totalAmount }}</div>
<div class="intro">总交易{{ info.waitCount }}</div>
</div>
</div>
<div class="item">
<div class="icon_wrap" style="background-color: #DFFECC;">
<i class="icon el-icon-success" style="color:#47B505;"></i>
</div>
<div class="info">
<div class="n">{{ info.paidAmount }}</div>
<div class="intro">已支付金额</div>
</div>
</div>
<div class="item">
<div class="icon_wrap" style="background-color: #FFE7D6;">
<i class="icon el-icon-circle-plus" style="color: #FF6B00;"></i>
</div>
<div class="info">
<div class="n">{{ info.waitAmount }}</div>
<div class="intro">待支付金额</div>
</div>
</div>
<div class="item">
<div class="icon_wrap" style="background-color: #FFF1D5;">
<i class="icon el-icon-warning" style="color: #FEB420;"></i>
</div>
<div class="info">
<div class="n">{{ info.waitNumber }}</div>
<div class="intro">待支付笔数</div>
</div>
</div>
</div>
</div>
<div class="head-container">
<div class="select_count_wrap">
<div class="select_count">
<i class="icon el-icon-warning"></i>
已选中
<span class="n">{{ selectCount }}</span>
</div>
<el-button>批量付款</el-button>
</div>
</div>
<div class="head-container">
<el-table :data="tableData.list" v-loading="tableData.loading" @select="selectHandle"
@select-all="selectHandle">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column label="创建日期" prop="createdAt">
<template v-slot="scope">
{{ dayjs(scope.row.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
</template>
</el-table-column>
<el-table-column label="类型" prop="type">
<template v-slot="scope">
进货单
</template>
</el-table-column>
<el-table-column label="总金额" prop="totalAmount">
<template v-slot="scope">
{{ scope.row.totalAmount }}
</template>
</el-table-column>
<el-table-column label="待付款金额" prop="waitAmount">
<template v-slot="scope">
<span class="num" v-if="scope.row.waitAmount > 0">{{ scope.row.waitAmount }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="状态" prop="status">
<template v-slot="scope">
<el-tag type="info">{{ types.find(item => item.value == scope.row.status).label }}</el-tag>
</template>
</el-table-column>
<el-table-column label="备注" prop="remark"></el-table-column>
<el-table-column label="付款时间" prop="updatedAt">
<template v-slot="scope">
{{ scope.row.paidAt && dayjs(scope.row.paidAt).format('YYYY-MM-DD HH:mm:ss') }}
</template>
</el-table-column>
<el-table-column label="操作" width="80">
<template v-slot="scope">
<router-link :to="{ name: 'purchase_detail', query: { purveyorId: scope.row.purveyorId } }">
<el-button type="text" size="mini">查看详情</el-button>
</router-link>
</template>
</el-table-column>
</el-table>
</div>
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
</template>
<script>
import dayjs from 'dayjs'
import { tbShopPurveyorTransactInfo, dictDetail, tbShopPurveyorTransactSum } from '@/api/invoicing'
export default {
data() {
return {
dayjs,
timeList: [
{
label: '全部',
value: 'all'
},
{
label: '今天',
value: '0'
},
{
label: '昨天',
value: '-1'
},
{
label: '最近7天',
value: '-7'
},
{
label: '最近30天',
value: '-30'
},
{
label: '本周',
value: 'week'
},
{
label: '本月',
value: 'moth'
},
{
label: '自定义',
value: 'custom'
}
],
types: [],
selectCount: 0,
query: {
type: '',
time: 'all',
createdAt: []
},
tableData: {
page: 0,
size: 10,
total: 0,
sort: 'id',
loading: false,
list: []
},
info: ''
}
},
mounted() {
this.dictDetail()
this.getTableData()
this.tbShopPurveyorTransactSum()
},
methods: {
async getTableData() {
this.tableData.loading = true
try {
const res = await tbShopPurveyorTransactInfo({
page: this.tableData.page,
size: this.tableData.size,
sort: this.tableData.sort,
purveyorId: this.$route.query.purveyorId,
status: this.query.type,
type: 'purveyor',
createdAt: this.query.createdAt
})
this.tableData.loading = false
this.tableData.list = res.content
this.tableData.total = res.totalElements
} catch (error) {
console.log(error);
}
},
// 重置查询
resetHandle() {
this.query.time = 'all'
this.query.createdAt = []
this.tableData.page = 0;
this.getTableData()
},
// 分页回调
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
},
async dictDetail() {
const { content } = await dictDetail({
dictName: 'purveyor_transact_status',
size: 100,
page: 0
})
this.types = content
},
// 选择时间
timeChange(e) {
this.query.createdAt = []
const format0 = 'YYYY-MM-DD 00:00:00'
const format1 = 'YYYY-MM-DD 23:59:59'
switch (e) {
case '0':
this.query.createdAt = [dayjs().format(format0), dayjs().format(format1)]
break;
case '-1':
this.query.createdAt = [dayjs().add(-1, 'day').format(format0), dayjs().add(-1, 'day').format(format1)]
break;
case '-7':
this.query.createdAt = [dayjs().add(-7, 'day').format(format0), dayjs().format(format1)]
break;
case '-30':
this.query.createdAt = [dayjs().add(-30, 'day').format(format0), dayjs().format(format1)]
break;
case 'week':
this.query.createdAt = [dayjs().startOf('week').format(format0), dayjs().endOf('week').format(format1)]
break;
case 'moth':
this.query.createdAt = [dayjs().startOf('month').format(format0), dayjs().endOf('month').format(format1)]
break;
default:
break;
}
this.getTableData()
},
selectHandle(selection, row) {
this.selectCount = 0
this.selectCount = selection.length
},
async tbShopPurveyorTransactSum() {
this.info = await tbShopPurveyorTransactSum({ purveyorId: this.$route.query.purveyorId, type: 'purveyor' })
}
}
}
</script>
<style scoped lang="scss">
.select_count_wrap {
display: flex;
align-items: center;
.select_count {
display: flex;
align-items: center;
justify-content: center;
background-color: #e7f3ff;
width: 120px;
height: 40px;
font-size: 14px;
margin-right: 10px;
border-radius: 4px;
.icon {
margin-right: 4px;
}
.n {
margin: 0 4px;
}
.icon,
.n {
color: #409EFF;
}
}
}
.num {
color: #F56C6C;
font-weight: bold;
}
.count {
color: #409EFF;
}
.info_list {
display: flex;
gap: 20px;
.item {
flex: 1;
background-color: #fff;
padding: 20px;
display: flex;
align-items: center;
background-color: #f5f5f5;
.icon_wrap {
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
padding: 2px;
.icon {
font-size: 40px;
}
}
.info {
flex: 1;
display: flex;
flex-direction: column;
padding-left: 20px;
.n {
font-size: 28px;
text-indent: -6px;
}
.intro {
font-size: 12px;
color: #999;
}
}
}
}
</style>

View File

@@ -0,0 +1,136 @@
<template>
<div class="app-container">
<div class="head-container">
<div class="filter_wrap">
<el-input v-model="query.name" clearable placeholder="供应商" @keyup.enter.native="getTableData"
style="width: 200px;" />
<el-select v-model="query.type" placeholder="付款状态">
<el-option :label="item.label" :value="item.value" v-for="item in types" :key="item.id"></el-option>
</el-select>
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</div>
</div>
<div class="head-container">
<el-table :data="tableData.list" v-loading="tableData.loading">
<el-table-column label="供应商" prop="purveyorName"></el-table-column>
<el-table-column label="剩余付款金额" prop="waitAmount">
<template v-slot="scope">
<span class="num" v-if="scope.row.waitAmount > 0">{{ scope.row.waitAmount }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="待付款笔数" prop="waitCount">
<template v-slot="scope">
<template v-if="scope.row.waitCount > 0">
<span class="count">{{ scope.row.waitCount }}</span>未付
</template>
<template v-else>-</template>
</template>
</el-table-column>
<el-table-column label="状态" prop="type">
<template v-slot="scope">
<el-tag :type="scope.row.type == 0 ? 'warning' : 'success'">
{{ scope.row.type == 0 ? '待支付' : '已完结' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="上笔进货日期" prop="lastTransactAt">
<template v-slot="scope">
{{ dayjs(scope.row.lastTransactAt).format('YYYY-MM-DD HH:mm:ss') }}
</template>
</el-table-column>
<el-table-column label="操作" width="80">
<template v-slot="scope">
<router-link :to="{ name: 'purchase_detail', query: { purveyorId: scope.row.purveyorId } }">
<el-button type="text" size="mini">查看详情</el-button>
</router-link>
</template>
</el-table-column>
</el-table>
</div>
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
</template>
<script>
import dayjs from 'dayjs'
import { tbShopPurveyorTransactGet, dictDetail } from '@/api/invoicing'
export default {
data() {
return {
dayjs,
types: [],
query: {
name: '',
type: ''
},
tableData: {
page: 0,
size: 10,
total: 0,
sort: 'id',
loading: false,
list: []
}
}
},
mounted() {
this.dictDetail()
this.getTableData()
},
methods: {
async getTableData() {
this.tableData.loading = true
try {
const res = await tbShopPurveyorTransactGet({
page: this.tableData.page,
size: this.tableData.size,
sort: this.tableData.sort,
purveyorName: this.query.name,
status: this.query.type,
type: 'reject',
shopId: localStorage.getItem('shopId')
})
this.tableData.loading = false
this.tableData.list = res.content
this.tableData.total = res.totalElements
} catch (error) {
console.log(error);
}
},
// 重置查询
resetHandle() {
this.query.name = ''
this.query.type = ''
this.tableData.page = 0;
this.getTableData()
},
// 分页回调
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
},
async dictDetail() {
const { content } = await dictDetail({
dictName: 'purveyor_transact_status',
size: 100,
page: 0
})
this.types = content
}
}
}
</script>
<style scoped lang="scss">
.num {
color: #F56C6C;
font-weight: bold;
}
.count {
color: #409EFF;
}
</style>

View File

@@ -0,0 +1,110 @@
<template>
<div class="app-container">
<div class="head-container">
<div class="filter_wrap">
<el-input v-model="query.name" size="small" clearable placeholder="供应商" @keyup.enter.native="getTableData"
style="width: 200px;" />
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</div>
</div>
<div class="head-container">
<el-button type="primary" icon="el-icon-plus" @click="$refs.addSupplier.show()">添加供应商</el-button>
</div>
<div class="head-container">
<el-table :data="tableData.list" v-loading="tableData.loading">
<el-table-column label="供应商" prop="purveyorName"></el-table-column>
<el-table-column label="联系电话" prop="purveyorTelephone"></el-table-column>
<el-table-column label="地址" prop="address"></el-table-column>
<el-table-column label="标签" prop="tip"></el-table-column>
<el-table-column label="备注" prop="remark"></el-table-column>
<el-table-column label="操作" width="200">
<template v-slot="scope">
<el-button type="text" size="mini" round icon="el-icon-edit"
@click="$refs.addSupplier.show(scope.row)">编辑</el-button>
<el-popconfirm title="确定删除吗?" @confirm="delHandle([scope.row.id])">
<el-button type="text" size="mini" round icon="el-icon-delete" slot="reference">
删除
</el-button>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
</div>
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
<addSupplier ref="addSupplier" @success="getTableData" />
</div>
</template>
<script>
import { tbShopPurveyorGet, tbShopPurveyor } from '@/api/invoicing'
import addSupplier from '../components/addSupplier'
export default {
components: {
addSupplier
},
data() {
return {
query: {
name: ''
},
tableData: {
page: 0,
size: 10,
total: 0,
sort: 'id',
loading: false,
list: []
}
}
},
mounted() {
this.getTableData()
},
methods: {
// 删除
async delHandle(ids) {
try {
await tbShopPurveyor(ids, 'delete')
this.$notify({
title: '成功',
message: `删除成功`,
type: 'success'
});
this.getTableData()
} catch (error) {
console.log(error)
}
},
async getTableData() {
this.tableData.loading = true
try {
const res = await tbShopPurveyorGet({
page: this.tableData.page,
size: this.tableData.size,
sort: this.tableData.sort,
purveyorName: this.query.name,
shopId: localStorage.getItem('shopId')
})
this.tableData.loading = false
this.tableData.list = res.content
this.tableData.total = res.totalElements
} catch (error) {
console.log(error);
}
},
// 重置查询
resetHandle() {
this.query.name = ''
this.tableData.page = 0;
this.getTableData()
},
// 分页回调
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
}
}
}
</script>