新增库存盘点
This commit is contained in:
@@ -5,10 +5,12 @@ ENV = 'development'
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.42:8000'
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.133:8000'
|
||||
# 测试
|
||||
VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
|
||||
# VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
|
||||
# 生产
|
||||
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.96:8000'
|
||||
# 张松
|
||||
VUE_APP_BASE_API = 'http://192.168.2.147:8000/'
|
||||
VUE_APP_WS_API = 'ws://192.168.2.128:8000'
|
||||
|
||||
# 是否启用 babel-plugin-dynamic-import-node插
|
||||
@@ -262,3 +262,33 @@ export function stockStateChanges(params) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增盘点
|
||||
* @returns
|
||||
*/
|
||||
export function tbProductStocktakin(data) {
|
||||
return request({
|
||||
url: `/api/tbProductStocktakin`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘点记录查询
|
||||
* @returns
|
||||
*/
|
||||
export function tbProductStocktakinGet(data) {
|
||||
return request({
|
||||
url: `/api/tbProductStocktakin`,
|
||||
method: "get",
|
||||
params: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
201
src/views/invoicing/components/addStockTakin.vue
Normal file
201
src/views/invoicing/components/addStockTakin.vue
Normal file
@@ -0,0 +1,201 @@
|
||||
<!-- 新增库存盘点 -->
|
||||
<template>
|
||||
<el-dialog title="库存盘点" :visible.sync="dialogVisible">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-position="left" inline>
|
||||
<el-form-item label="账存数量">
|
||||
<el-input v-model="detail.stockNumber" readonly></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="实际数量" prop="stocktakinNum">
|
||||
<el-input-number v-model="form.stocktakinNum"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="盈亏数量">
|
||||
<el-input v-model="profitNumber" readonly :class="{ lose: profitNumber < 0 }"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="单价">
|
||||
<el-input v-model="detail.salePrice" readonly></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="盈亏金额">
|
||||
<el-input v-model="profitPrice" readonly :class="{ lose: profitNumber < 0 }"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.note" placeholder="请输入备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">确 定</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="head-container">
|
||||
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading" border stripe>
|
||||
<el-table-column label="商品信息" width="150px">
|
||||
<template v-slot="scope">
|
||||
<div class="shop_info">
|
||||
<el-image :src="scope.row.coverImg" style="width: 30px;height: 30px;">
|
||||
<div class="img_error" slot="error">
|
||||
<i class="icon el-icon-document-delete"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<span>{{ scope.row.name }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售价" prop="price">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.price }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库存" prop="stock"></el-table-column>
|
||||
<el-table-column label="盈亏数量" prop="phaseNum"></el-table-column>
|
||||
<el-table-column label="盈亏金额" prop="phasePrice">
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.phasePrice }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="盘点数量" prop="inventoryStock"></el-table-column>
|
||||
<el-table-column label="盘点时间" prop="createTime"></el-table-column>
|
||||
<el-table-column label="盘点备注" prop="note"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-sizes="[5, 10, 30, 50]"
|
||||
:page-size="tableData.size" @current-change="paginationChange" @size-change="sizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tbProductStocktakin, tbProductStocktakinGet } from '@/api/invoicing'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
detail: '',
|
||||
form: {
|
||||
skuId: '', // sku商品必传
|
||||
productId: '', // 必传
|
||||
stocktakinNum: '', // 必传
|
||||
price: '', // 商品价格 非必传 为空盘点价格为商品价格
|
||||
note: "" // 盘点备注 非必传
|
||||
},
|
||||
rules: {
|
||||
stocktakinNum: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入盘点数量',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
resetForm: '',
|
||||
searhForm: {
|
||||
name: '',
|
||||
skuId: '',
|
||||
productId: ''
|
||||
},
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 5,
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: []
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form }
|
||||
},
|
||||
computed: {
|
||||
profitNumber() {
|
||||
return this.form.stocktakinNum - this.detail.stockNumber
|
||||
},
|
||||
profitPrice() {
|
||||
return (this.form.stocktakinNum - this.detail.stockNumber) * this.detail.salePrice
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSubmitHandle() {
|
||||
this.$refs.form.validate(async valid => {
|
||||
if (valid) {
|
||||
try {
|
||||
this.loading = true
|
||||
let res = await tbProductStocktakin(this.form)
|
||||
this.detail.stockNumber = this.form.stocktakinNum
|
||||
this.$emit('success', res)
|
||||
// this.dialogVisible = false
|
||||
this.loading = false
|
||||
this.$notify({
|
||||
title: '注意',
|
||||
message: `添加成功`,
|
||||
type: 'success'
|
||||
});
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
this.dialogVisible = false
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
show(obj) {
|
||||
console.log(obj);
|
||||
this.detail = { ...obj }
|
||||
this.dialogVisible = true
|
||||
this.form.skuId = obj.skuId
|
||||
this.form.productId = obj.proId
|
||||
this.form.stocktakinNum = obj.stockNumber
|
||||
|
||||
this.searhForm.skuId = obj.productId
|
||||
this.searhForm.productId = obj.proId
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页大小改变
|
||||
sizeChange(e) {
|
||||
this.tableData.size = e
|
||||
this.getTableData()
|
||||
},
|
||||
// 分页回调
|
||||
paginationChange(e) {
|
||||
this.tableData.page = e - 1
|
||||
this.getTableData()
|
||||
},
|
||||
// 商品列表
|
||||
async getTableData() {
|
||||
try {
|
||||
this.tableData.loading = true
|
||||
const res = await tbProductStocktakinGet({
|
||||
page: this.tableData.page,
|
||||
size: this.tableData.size,
|
||||
name: this.searhForm.name,
|
||||
skuId: this.searhForm.category,
|
||||
productId: this.searhForm.productId,
|
||||
sort: 'id',
|
||||
})
|
||||
this.tableData.list = res.content
|
||||
this.tableData.total = res.totalElements
|
||||
setTimeout(() => {
|
||||
this.tableData.loading = false
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.lose {
|
||||
&::v-deep .el-input__inner {
|
||||
color: rgb(238, 29, 29);
|
||||
}
|
||||
}
|
||||
|
||||
.shop_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -56,9 +56,9 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库存" prop="number" >
|
||||
<template v-slot="scope" >
|
||||
<span :class="[scope.row.stockNumber<=warnLine?'colorStyle':'']">
|
||||
<el-table-column label="库存" prop="number">
|
||||
<template v-slot="scope">
|
||||
<span :class="[scope.row.stockNumber <= warnLine ? 'colorStyle' : '']">
|
||||
{{ `${scope.row.stockNumber} ${scope.row.unitName}` }}
|
||||
</span>
|
||||
</template>
|
||||
@@ -83,10 +83,14 @@
|
||||
@change="showChangess($event, scope.row)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="220">
|
||||
<el-table-column label="操作" width="240px">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" size="mini"
|
||||
@click="$refs.invoicingDetail.show(scope.row)">库存记录</el-button>
|
||||
<template v-if="!scope.row.hasChildren">
|
||||
<el-button type="text" size="mini" style="margin-left: 10px !important;"
|
||||
@click="$refs.AddStockTakin.show(scope.row)">库存盘点</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -112,6 +116,8 @@
|
||||
<el-button type="primary" @click="sumbit()">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 新增库存盘点 -->
|
||||
<AddStockTakin ref="AddStockTakin" @success="getTableData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -119,12 +125,14 @@
|
||||
import { stock, stockdownload, stockdoImport, stockStatewarnLine, stockStateChanges, stocks } from '@/api/invoicing'
|
||||
import settings from '@/settings'
|
||||
import invoicingDetail from './components/invoicingDetail'
|
||||
import AddStockTakin from './components/addStockTakin'
|
||||
import UploadExcel from '@/components/UploadExcel/'
|
||||
import { downloadFile } from "@/utils/index";
|
||||
export default {
|
||||
components: {
|
||||
invoicingDetail,
|
||||
UploadExcel
|
||||
UploadExcel,
|
||||
AddStockTakin
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -138,10 +146,10 @@ export default {
|
||||
},
|
||||
downloadLoading: false,
|
||||
uploadLoading: false,
|
||||
warnLine:null, // 警戒线
|
||||
warnLine: null, // 警戒线
|
||||
tableData: {
|
||||
page: 0,
|
||||
size: 10,
|
||||
size: 5,
|
||||
total: 0,
|
||||
sort: 'id',
|
||||
loading: false,
|
||||
@@ -284,7 +292,7 @@ export default {
|
||||
});
|
||||
this.warnLine = res.warnLine
|
||||
this.tableData.list = res.content
|
||||
|
||||
console.log(this.tableData.list);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -339,7 +347,8 @@ export default {
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
.colorStyle{
|
||||
|
||||
.colorStyle {
|
||||
color: rgb(231, 42, 42);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user