457 行
17 KiB
HTML
可执行文件
457 行
17 KiB
HTML
可执行文件
<!--[1.2.47]-->
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/goodsList.css"/>
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/myscroll.css"/>
|
|
<link rel="stylesheet" href="__PUBLIC__/vue/element-ui.css">
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
[v-cloak] {
|
|
display: none;
|
|
}
|
|
|
|
th {
|
|
background-color: #f5f7fa !important;
|
|
}
|
|
|
|
th > .cell {
|
|
white-space: nowrap !important;
|
|
text-align: center;
|
|
}
|
|
|
|
th, td {
|
|
text-align: center;
|
|
line-height: 30px;
|
|
padding: 0;
|
|
}
|
|
|
|
th > .cell, td > .cell {
|
|
text-align: center;
|
|
}
|
|
|
|
.el-table_1_column_13 {
|
|
border-right: none !important;
|
|
}
|
|
|
|
tr > td:nth-child(9) > .cell {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.el-pagination {
|
|
padding: 8px;
|
|
}
|
|
|
|
.el-input {
|
|
width: auto;
|
|
}
|
|
|
|
.save {
|
|
white-space: nowrap;
|
|
background-color: #409EFF;
|
|
color: white;
|
|
font-size: 12px;
|
|
line-height: 30px;
|
|
padding: 0 4px;
|
|
border-radius: 4px;
|
|
margin-left: 3px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.save:hover {
|
|
opacity: 0.8;
|
|
}
|
|
|
|
.save::selection {
|
|
background-color: transparent;
|
|
}
|
|
|
|
.el-input__inner {
|
|
padding: 0 3px;
|
|
text-align: center;
|
|
}
|
|
|
|
.center-content {
|
|
margin: 20px 0;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.center-content .el-input__inner {
|
|
padding: 0 15px;
|
|
text-align: left;
|
|
}
|
|
</style>
|
|
<div id="app" v-cloak>
|
|
<div class="goodsBox">
|
|
<div class="goods_title">
|
|
<div class="goods_title_inner">
|
|
库存盘点 <span style="color: #409EFF">(盘点时请注意小程序商城订单完成状态,避免单品盘点数量出现误差)</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div style="text-align: right;">
|
|
</div>
|
|
<div class="center-content">
|
|
<div>
|
|
<el-input placeholder="品名/货号/条形码"
|
|
type="text"
|
|
size="small"
|
|
v-model="searchText"
|
|
clearable
|
|
@input.native.prevent="inputSearchText(searchText)"
|
|
@keydown.enter.exact.native.prevent="getData"></el-input>
|
|
|
|
<el-select size="small" filterable v-if="goodsClass1.length" @change="changeGoodsClass1($event)"
|
|
v-model="goodsClassId1" placeholder="请选择一级分类">
|
|
<el-option key="0" value="0" label="请选择一级分类" style="color:#ccc"></el-option>
|
|
<el-option
|
|
v-for="item in goodsClass1"
|
|
:key="item.id"
|
|
:label="item.class_name"
|
|
:value="item.id">
|
|
</el-option>
|
|
</el-select>
|
|
<el-select size="small" filterable v-if="goodsClass2.length" @change="changeGoodsClass2($event)"
|
|
v-model="goodsClassId2" placeholder="请选择二级分类">
|
|
<el-option key="0" value="0" label="请选择二级分类" style="color:#ccc"></el-option>
|
|
<el-option
|
|
v-for="item in goodsClass2"
|
|
:key="item.id"
|
|
:label="item.class_name"
|
|
:value="item.id">
|
|
</el-option>
|
|
</el-select>
|
|
<el-select size="small" filterable v-if="goodsClass3.length" @change="changeGoodsClass3($event)"
|
|
v-model="goodsClassId3" placeholder="请选择三级分类">
|
|
<el-option key="0" value="0" label="请选择三级分类" style="color:#ccc"></el-option>
|
|
<el-option
|
|
v-for="item in goodsClass3"
|
|
:key="item.id"
|
|
:label="item.class_name"
|
|
:value="item.id">
|
|
</el-option>
|
|
</el-select>
|
|
<el-button type="primary" plain @click="getData" size="small">搜索</el-button>
|
|
</div>
|
|
<if condition="$global_store_jurisdiction && ($global_store_jurisdiction['check_goods_pd'] eq '2')">
|
|
<else/>
|
|
<if condition="$authArr['doInventory']">
|
|
<el-button type="primary" @click="doPD" title="盘点时请注意单品保存" size="medium">确认盘点</el-button>
|
|
</if>
|
|
</if>
|
|
</div>
|
|
<div class="center-content">
|
|
<el-select @change="changeGoodsType($event)" v-model="goodsType" placeholder="请选择">
|
|
<el-option
|
|
v-for="item in goodsTypeList"
|
|
:key="item.val"
|
|
:label="item.name"
|
|
:value="item.val">
|
|
</el-option>
|
|
</el-select>
|
|
<el-button v-if="checkedList.length" type="primary" plain @click="saveAll" size="medium">批量保存</el-button>
|
|
</div>
|
|
|
|
<div style="border: 1px solid #e6e6e6;width: calc(100vw - 208px);">
|
|
<el-table border :data="goodsList" style="width: calc(100vw - 208px);box-sizing: border-box;border: none;" @selection-change="handleSelectionChange">
|
|
<el-table-column type="selection" width="40"></el-table-column>
|
|
<el-table-column prop="index" label="序号" width="50"></el-table-column>
|
|
<el-table-column prop="goods_number" label="货号" width="80" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="goods_name" label="品名" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="goods_code" width="135" label="条码" show-overflow-tooltip></el-table-column>
|
|
<el-table-column v-if="showPurchPrice" prop="purch_price" label="进价" width="80"></el-table-column>
|
|
<el-table-column prop="retail_price" label="零售价" width="80"></el-table-column>
|
|
<el-table-column prop="goods_num" label="系统库存" width="100"></el-table-column>
|
|
<el-table-column prop="check_num" label="实际(盘点)库存" width="130">
|
|
<template slot-scope="scope">
|
|
<el-input type="text"
|
|
size="small"
|
|
v-model="goodsList[scope.$index].check_num"
|
|
@input.native.prevent="inputPDNum(scope.$index,goodsList[scope.$index].check_num)"
|
|
@keydown.enter.exact.native.prevent="save(scope.$index)"></el-input>
|
|
<span class="save"
|
|
v-if="goodsList[scope.$index].check_num!=goodsList[scope.$index].old_check_num"
|
|
@click="save(scope.$index)">保存</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="end_num" label="盈亏数量" width="100"></el-table-column>
|
|
<el-table-column prop="end_price" label="盈亏金额" width="100"></el-table-column>
|
|
<el-table-column fixed="right" label="盘点记录" width="80" style="border-right: none;">
|
|
<template slot-scope="scope">
|
|
<if condition="$authArr['see_more']">
|
|
<el-button @click.native.prevent="seeMore(scope.$index)" type="text" size="small">查看</el-button>
|
|
</if>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<el-pagination
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"
|
|
:current-page="currentPage"
|
|
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]"
|
|
:page-size="100"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
:total="len">
|
|
</el-pagination>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
var layer;
|
|
layui.use('layer', function () {
|
|
layer = layui.layer;
|
|
})
|
|
var goodsClass1 = {$class1};
|
|
var showpurch_price = "{$global_store_jurisdiction['showpurch_price']}";// == 2
|
|
var app = new Vue({
|
|
el: '#app',
|
|
data: function () {
|
|
return {
|
|
goodsList: [],
|
|
len: 0,
|
|
currentPage: 1,
|
|
currentLimit: 10,
|
|
goodsType: 1,
|
|
goodsTypeList: [
|
|
{
|
|
val: 1, name: '所有商品'
|
|
}, {
|
|
val: 2, name: '已盘商品'
|
|
}, {
|
|
val: 3, name: '未盘商品'
|
|
}
|
|
],
|
|
checkedList: [],
|
|
searchText: '',
|
|
goodsClass1: goodsClass1,
|
|
goodsClass2: [],
|
|
goodsClass3: [],
|
|
goodsClassId1: '',
|
|
goodsClassId2: '',
|
|
goodsClassId3: '',
|
|
showPurchPrice: showpurch_price == 2 ? false : true,
|
|
}
|
|
},
|
|
methods: {
|
|
getGoodsClass: function (id, type) {
|
|
var that = this;
|
|
$.post("{:U('Sale/getChildClass')}", {
|
|
id: id,
|
|
type: type
|
|
}, function (res) {
|
|
if (res.status == 1) {
|
|
switch (type) {
|
|
case 2:
|
|
that.goodsClass2 = [];
|
|
that.goodsClass2 = res.data;
|
|
that.goodsClassId2 = '';
|
|
that.goodsClass3 = [];
|
|
that.goodsClassId3 = '';
|
|
break;
|
|
case 3:
|
|
that.goodsClass3 = [];
|
|
that.goodsClass3 = res.data;
|
|
that.goodsClassId3 = '';
|
|
break;
|
|
}
|
|
} else {
|
|
switch (type) {
|
|
case 2:
|
|
that.goodsClass2 = [];
|
|
that.goodsClassId2 = '';
|
|
break;
|
|
case 3:
|
|
that.goodsClass3 = [];
|
|
that.goodsClassId3 = '';
|
|
break;
|
|
}
|
|
}
|
|
})
|
|
},
|
|
changeGoodsClass1: function (val) {
|
|
if (val == 0) {
|
|
this.goodsClass2 = [];
|
|
this.goodsClassId2 = '';
|
|
this.goodsClass3 = [];
|
|
this.goodsClassId3 = '';
|
|
} else {
|
|
this.getGoodsClass(val, 2);
|
|
}
|
|
},
|
|
changeGoodsClass2: function (val) {
|
|
if (val == 0) {
|
|
this.goodsClass3 = [];
|
|
this.goodsClassId3 = '';
|
|
} else {
|
|
this.getGoodsClass(val, 3);
|
|
}
|
|
},
|
|
changeGoodsClass3: function (val) {
|
|
if (val == 0) {
|
|
this.goodsClassId3 = '';
|
|
}
|
|
},
|
|
inputSearchText: function (val) {
|
|
this.searchText = val;
|
|
},
|
|
handleSelectionChange: function (data) {
|
|
console.log(data)
|
|
this.checkedList = [];
|
|
this.checkedList = data;
|
|
},
|
|
changeGoodsType: function () {
|
|
this.getData();
|
|
},
|
|
handleSizeChange(val) {
|
|
this.currentLimit = val;//切换每页数量
|
|
this.currentPage = 1;
|
|
this.getData();
|
|
},
|
|
handleCurrentChange(val) {
|
|
this.currentPage = val;
|
|
this.getData();//切换页数
|
|
},
|
|
getData: function () {
|
|
var that = this;
|
|
$.post("{:U(getWaitingPDGoods)}", {
|
|
page: this.currentPage,
|
|
limit: this.currentLimit,
|
|
type: this.goodsType,
|
|
keyword: this.searchText,
|
|
goodsClass1: this.goodsClassId1,
|
|
goodsClass2: this.goodsClassId2,
|
|
goodsClass3: this.goodsClassId3
|
|
}, function (res) {
|
|
if (res.status == 1) {
|
|
that.goodsList = [];
|
|
that.goodsList = res.data;
|
|
that.$nextTick(function () {
|
|
that.len = res.count;
|
|
that.currentPage = res.page;
|
|
})
|
|
} else {
|
|
that.$confirm(res.msg, '提示', {
|
|
confirmButtonText: '确定',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
location.href = "{:U('Login/index')}?code=1"
|
|
});
|
|
}
|
|
})
|
|
},
|
|
inputPDNum: function (index, num) {
|
|
if (this.goodsList[index].can_exchange_weigh == 1) {
|
|
num = num.replace(/[^0-9]/g, '');
|
|
} else {
|
|
num = num.replace(/[^0-9.]/g, '');
|
|
// num = num.replace(/[]/)
|
|
}
|
|
var goodsList = this.goodsList;
|
|
goodsList[index].check_num = num;
|
|
this.goodsList = [];
|
|
this.goodsList = goodsList;
|
|
},
|
|
seeMore: function (index) {
|
|
layer.open({
|
|
content: "{:U('see_more')}?id=" + this.goodsList[index].id,
|
|
area: ['800px', '600px'],
|
|
type: 2,
|
|
title: this.goodsList[index].goods_name + ' 盘点记录'
|
|
})
|
|
},
|
|
save: function (index) {
|
|
console.log(index)
|
|
var that = this;
|
|
$.post("{:U('savePDNum_v1')}", {
|
|
id: that.goodsList[index].id,
|
|
num: that.goodsList[index].check_num
|
|
}, function (res) {
|
|
that.$notify({
|
|
title: '提示',
|
|
message: res.msg,
|
|
type: 'success',
|
|
duration: 800
|
|
});
|
|
if (res.status == 1) {
|
|
var goodsList = that.goodsList;
|
|
goodsList[index].old_check_num = goodsList[index].check_num;
|
|
that.goodsList = [];
|
|
that.goodsList = goodsList;
|
|
that.getData();
|
|
}
|
|
})
|
|
},
|
|
saveAll: function () {
|
|
var that = this;
|
|
this.$confirm('确定进行批量盘点库存?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'info'
|
|
}).then(() => {
|
|
$.ajax({
|
|
url: "{:U('saveAllPDNum')}",
|
|
type: 'post',
|
|
data: {
|
|
data: that.checkedList
|
|
},
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
that.$message({
|
|
type: 'success',
|
|
message: res.msg,
|
|
duration: 1000
|
|
});
|
|
that.getData();
|
|
} else {
|
|
that.$message({
|
|
type: 'warning',
|
|
message: res.msg
|
|
});
|
|
}
|
|
}
|
|
})
|
|
});
|
|
},
|
|
doPD: function () {
|
|
var that = this;
|
|
this.$confirm('确定审核盘点数据?', '审核后商品库存将以盘点(实际)库存为准', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'info'
|
|
}).then(() => {
|
|
$.ajax({
|
|
url: "{:U('doInventory')}",
|
|
type: 'post',
|
|
data: {yknum: $('.allnum').text(), ykmoney: $('.alljiner').text()},
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
that.$message({
|
|
type: 'success',
|
|
message: res.msg,
|
|
onClose: function () {
|
|
MenuApp.refreshWindow();
|
|
//window.location.replace("{:U('index')}")
|
|
}
|
|
});
|
|
} else {
|
|
that.$message({
|
|
type: 'warning',
|
|
message: res.msg
|
|
});
|
|
}
|
|
}
|
|
})
|
|
});
|
|
|
|
}
|
|
},
|
|
created: function () {
|
|
this.getData();
|
|
}
|
|
|
|
})
|
|
</script> |