537 行
20 KiB
HTML
可执行文件
537 行
20 KiB
HTML
可执行文件
<!DOCTYPE html>
|
|
<html>
|
|
<!--[1.7.90]-->
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport"
|
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>新增调价单</title>
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/vue/element-ui.css">
|
|
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
|
|
</head>
|
|
|
|
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
|
|
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/vue/element-ui.js"></script>
|
|
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/js/common.js"></script>
|
|
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Retail/common/js/select-goods-category.js"></script>
|
|
<style>
|
|
.must-edit {
|
|
color: red;
|
|
}
|
|
|
|
.form-textarea {
|
|
margin: 20px 0;
|
|
}
|
|
|
|
.form-button {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
.form-textarea-title {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.form-table-total {
|
|
margin: 10px 0;
|
|
}
|
|
|
|
.table-total {
|
|
text-align: right;
|
|
padding: 15px;
|
|
background: #f5f7fa;
|
|
color: #606266;
|
|
border: 1px solid #ebeef5;
|
|
border-top: none;
|
|
}
|
|
|
|
.table-total > span {
|
|
color: #409EFF;
|
|
}
|
|
|
|
.el-input-remote {
|
|
width: 140px;
|
|
}
|
|
|
|
.size-details {
|
|
display: flex;
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
justify-content: space-between;
|
|
padding-bottom: 20px;
|
|
border-bottom: 1px solid #ebeef5;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.size-details-list {
|
|
box-sizing: border-box;
|
|
width: 45%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.size-input {
|
|
width: 120px;
|
|
}
|
|
|
|
.size-title {
|
|
padding: 10px;
|
|
background: #f5f7fa;
|
|
color: #606266;
|
|
border: 1px solid #ebeef5;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.size-footer {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.size-all {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.size-all-input {
|
|
width: 60px;
|
|
}
|
|
|
|
[v-cloak] {
|
|
display: none;
|
|
}
|
|
|
|
.el-dialog {
|
|
width: 90%;
|
|
}
|
|
|
|
th > .cell, td > .cell {
|
|
text-align: center;
|
|
}
|
|
|
|
.layui-table {
|
|
width: 100%;
|
|
margin-bottom: 20px;
|
|
border: 1px solid #ebeef5;
|
|
border-radius: 5px;
|
|
padding: 10px 0;
|
|
}
|
|
|
|
.layui-table td {
|
|
text-align: center;
|
|
}
|
|
</style>
|
|
|
|
<body>
|
|
<div id="goods" v-cloak>
|
|
<div class="text item" id="loading_examine">
|
|
<div style="display: flex">
|
|
<span class="must-edit">*</span>
|
|
<el-select v-model="type" placeholder="请选择类型"
|
|
@change="typeSelect"
|
|
size="small"
|
|
clearable
|
|
style="margin-right:20px">
|
|
<el-option label="初始化入库" value="1"></el-option>
|
|
<el-option label="采购批次号" value="2"></el-option>
|
|
<el-option label="其他入库" value="3"></el-option>
|
|
</el-select>
|
|
<el-input placeholder="修改单号"
|
|
clearable
|
|
type="text"
|
|
size="small"
|
|
v-model="modify_order_number" style="width:220px;margin-right: 20px"></el-input>
|
|
<if condition="$authArr['goodsChoice'] eq true">
|
|
<el-button size="small" @click="goodsChoice" type="primary">选择商品</el-button>
|
|
</if>
|
|
</div>
|
|
<div class="form-table">
|
|
<el-table :header-cell-style="{background:'#F5F7FA',color:'#606266'}"
|
|
:data="goodsList"
|
|
border size="small"
|
|
v-loading="loading"
|
|
style="width: 100%; margin-top: 20px">
|
|
<el-table-column label="" type="index" width="80"></el-table-column>
|
|
<el-table-column label="操作">
|
|
<template slot-scope="scope">
|
|
<el-button type="text" size="mini" @click="deleteTable(scope.$index)">删除</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="goods_name" label="商品"></el-table-column>
|
|
<el-table-column prop="sku_name" label="规格"></el-table-column>
|
|
<el-table-column label="货号">
|
|
<template slot-scope="scope">
|
|
<span v-if="scope.row.attribute_state == 1">{{scope.row.goods_number}}</span>
|
|
<span v-if="scope.row.attribute_state == 2">{{scope.row.sku_goods_number}}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="goods_code" label="条码">
|
|
<template slot-scope="scope">
|
|
<span v-if="scope.row.attribute_state == 1">{{scope.row.goods_code}}</span>
|
|
<span v-if="scope.row.attribute_state == 2">{{scope.row.sku_code}}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="company" label="单位"></el-table-column>
|
|
<el-table-column prop="purchase_price" label="原进价"></el-table-column>
|
|
<el-table-column label="进价">
|
|
<template slot-scope="scope">
|
|
<div class="el-form-item" @input="priceVerification(scope.row.cost_price)"
|
|
:class="color1?'':'is-error'">
|
|
<el-input size="mini" v-model="scope.row.cost_price "></el-input>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="remarks" label="备注">
|
|
<template slot-scope="scope">
|
|
<el-input type="textarea" v-model="scope.row.remarks"></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
<div class="form-textarea">
|
|
<div class="form-textarea-title">订单备注</div>
|
|
<el-input
|
|
type="textarea"
|
|
:rows="2"
|
|
placeholder="订单备注"
|
|
v-model="remarks">
|
|
</el-input>
|
|
</div>
|
|
<div class="form-button">
|
|
<el-button @click="cancel">取消</el-button>
|
|
<if condition="$authArr['onSubmit'] eq true">
|
|
<el-button type="primary" @click="onSubmit">确定</el-button>
|
|
</if>
|
|
</div>
|
|
</div>
|
|
<!--/弹出框/-->
|
|
<el-dialog title="选择商品" :append-to-body="true" :visible.sync="outerVisible">
|
|
<div class="dialog-details-first">
|
|
<template>
|
|
<div style="display: flex;">
|
|
<el-input size="small"
|
|
style="margin-right: 20px;width: 200px"
|
|
clearable
|
|
@keydown.enter.exact.native.prevent="searchGoods"
|
|
class="el-input-remote"
|
|
v-model="searchText"
|
|
placeholder="名称/货号/条码">
|
|
</el-input>
|
|
<select-goods-category :user-type="1"
|
|
:category-id1.sync="goodsClassId1"
|
|
:category-id2.sync="goodsClassId2"
|
|
:category-id3.sync="goodsClassId3"></select-goods-category>
|
|
<el-button type="primary" plain @click="searchGoods" size="small">搜索</el-button>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
<template>
|
|
<el-table :header-cell-style="{background:'#F5F7FA',color:'#606266'}"
|
|
:data="goodsArr"
|
|
border size="small"
|
|
@selection-change="handleSelectionChange"
|
|
style="width: 100%; margin-top: 20px">
|
|
<el-table-column type="selection" width="55"></el-table-column>
|
|
<el-table-column prop="index" label="序号"></el-table-column>
|
|
<el-table-column prop="goods_name" label="商品名称"></el-table-column>
|
|
<el-table-column prop="sku_name" label="规格"></el-table-column>
|
|
<el-table-column label="货号">
|
|
<template slot-scope="scope">
|
|
<span v-if="scope.row.attribute_state == 1">{{scope.row.goods_number}}</span>
|
|
<span v-if="scope.row.attribute_state == 2">{{scope.row.sku_goods_number}}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="goods_code" label="条码">
|
|
<template slot-scope="scope">
|
|
<span v-if="scope.row.attribute_state == 1">{{scope.row.goods_code}}</span>
|
|
<span v-if="scope.row.attribute_state == 2">{{scope.row.sku_code}}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="company" label="单位"></el-table-column>
|
|
<el-table-column prop="cost_price" label="进价"></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="currentLen">
|
|
</el-pagination>
|
|
</template>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="goodsSub(1)">提交</el-button>
|
|
<el-button @click="goodsSub(2)">提交并关闭</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
|
|
</div>
|
|
</body>
|
|
<script>
|
|
new Vue({
|
|
el: "#goods",
|
|
data: {
|
|
type: '',
|
|
modify_order_number: '',
|
|
color: true,
|
|
searchText: "",
|
|
goodsClassId1: "",
|
|
goodsClassId2: "",
|
|
goodsClassId3: "",
|
|
goodsArr: [], //商品档案信息
|
|
currentPage: 1,
|
|
currentLimit: 10,
|
|
currentLen: 0,
|
|
color1: true,
|
|
color2: true,
|
|
remarks: '',
|
|
num: 1,
|
|
size: true,
|
|
outerVisible: false,
|
|
innerVisible: false, //规格弹框
|
|
goodsList: [],
|
|
goodsSelection: [], //选中的商品
|
|
loading: false,
|
|
},
|
|
methods: {
|
|
//下拉框事件
|
|
typeSelect: function () {
|
|
this.goodsList = [];
|
|
this.goodsSelection = [];
|
|
this.goodsClassId1 = "";
|
|
this.goodsClassId2 = "";
|
|
this.goodsClassId3 = "";
|
|
this.searchText = "";
|
|
this.page = 1;
|
|
this.limit = 10;
|
|
this.modify_order_number = '';
|
|
},
|
|
//选择商品
|
|
goodsChoice: function () {
|
|
var type = this.type;
|
|
var modify_order_number = this.modify_order_number;
|
|
if (type == '') {
|
|
this.$message.error("请选择类型");
|
|
return;
|
|
} else if (type == 1) {
|
|
this.outerVisible = true;
|
|
} else if (modify_order_number != '') {
|
|
this.outerVisible = true;
|
|
} else if (type == 2) {
|
|
this.$message.error("请输入修改的采购批次号");
|
|
return;
|
|
} else {
|
|
this.$message.error("请输入修改的入库单号");
|
|
return;
|
|
}
|
|
this.getData();
|
|
},
|
|
|
|
//调价商品搜索
|
|
searchGoods: function () {
|
|
this.currentPage = 1;
|
|
this.getData();
|
|
},
|
|
//调价商品
|
|
getData: function () {
|
|
var that = this;
|
|
var type = that.type;
|
|
var modify_order_number = that.modify_order_number;
|
|
that.loading = true;
|
|
var goodsList = that.goodsList;
|
|
var notInIds = [];
|
|
if (goodsList.length > 0) {
|
|
for (var i = 0; i < goodsList.length; i++) {
|
|
notInIds.push(goodsList[i].id);
|
|
}
|
|
}
|
|
$.ajax({
|
|
url: "{:U(goodsList)}",
|
|
type: 'POST',
|
|
data: {
|
|
type: type,
|
|
modify_order_number: modify_order_number,
|
|
page: this.currentPage,
|
|
limit: this.currentLimit,
|
|
notInIds: notInIds,
|
|
searchText: this.searchText,
|
|
person1: this.goodsClassId1,
|
|
person2: this.goodsClassId2,
|
|
person3: this.goodsClassId3,
|
|
},
|
|
success: function (res) {
|
|
that.loading = false;
|
|
if (res.status == 1) {
|
|
that.loading = false;
|
|
that.goodsArr = [];
|
|
that.goodsArr = res.data;
|
|
that.$nextTick(function () {
|
|
that.currentLen = parseInt(res.count);
|
|
})
|
|
} else {
|
|
that.$confirm(res.msg, '提示', {
|
|
confirmButtonText: '确定',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
|
|
}).catch(() => {
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
//分页
|
|
handleSizeChange(val) {
|
|
this.currentLimit = val;
|
|
this.currentPage = 1;
|
|
this.getData();
|
|
|
|
},
|
|
handleCurrentChange(val) {
|
|
this.currentPage = val;
|
|
this.getData();
|
|
},
|
|
|
|
//选中的调价商品
|
|
handleSelectionChange: function (data) {
|
|
var that = this;
|
|
that.goodsSelection = data;
|
|
},
|
|
//商品提交
|
|
goodsSub: function (type) {
|
|
var that = this;
|
|
var goodsSelection = JSON.parse(JSON.stringify(that.goodsSelection));
|
|
var goodsList = that.goodsList;
|
|
if (!goodsSelection || goodsSelection.length == 0) {
|
|
that.$message({type: "error", message: "请选择调价的商品", duration: 1000})
|
|
return;
|
|
}
|
|
for (var i = 0; i < goodsSelection.length; i++) {
|
|
goodsSelection[i].remarks = "";
|
|
goodsSelection[i].purchase_price = goodsSelection[i].cost_price;
|
|
goodsList.push(goodsSelection[i]);
|
|
}
|
|
that.goodsList = [];
|
|
that.goodsList = goodsList;
|
|
if (type == 2) {
|
|
that.outerVisible = false
|
|
} else {
|
|
that.searchGoods();
|
|
}
|
|
},
|
|
//进价
|
|
priceVerification: function (price) {
|
|
var reg = /^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/;
|
|
if (!reg.test(price)) {
|
|
this.color1 = false;
|
|
} else {
|
|
this.color1 = true;
|
|
}
|
|
return color1;
|
|
},
|
|
deleteTable: function (index) {
|
|
this.goodsList.splice(index, 1);
|
|
},
|
|
cancel: function () {
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
parent.layer.close(index);
|
|
},
|
|
onSubmit: function () {
|
|
var that = this;
|
|
var goods_id = [];
|
|
var goodsList = that.goodsList;
|
|
var remarks = that.remarks;
|
|
var type = that.type;
|
|
var modify_order_number = that.modify_order_number;
|
|
var reg = /^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/;
|
|
if (goodsList.length <= 0) {
|
|
that.$message({type: "error", message: "请选择调价商品", duration: 1000})
|
|
return;
|
|
}
|
|
for (var i = 0; i < goodsList.length; i++) {
|
|
if (!goodsList[i].cost_price) {
|
|
that.$message({
|
|
type: "error",
|
|
message: goodsList[i].goods_name + goodsList[i].sku_name + "进价有误",
|
|
duration: 1000
|
|
})
|
|
return;
|
|
}
|
|
if (!reg.test(goodsList[i].cost_price)) {
|
|
that.$message({
|
|
type: "error",
|
|
message: goodsList[i].goods_name + goodsList[i].sku_name + "进价有误",
|
|
duration: 1000
|
|
})
|
|
return;
|
|
}
|
|
if (goods_id.includes(goodsList[i].id)) {
|
|
that.$message({
|
|
type: "error",
|
|
message: goodsList[i].goods_name + goodsList[i].sku_name + "存在重复",
|
|
duration: 1000
|
|
})
|
|
return;
|
|
}
|
|
goods_id.push(goodsList[i].id);
|
|
}
|
|
that.$confirm('请确认调价商品信息无误,提交后无法修改,是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
const loading_examine = that.$loading({
|
|
target: "#loading_examine",
|
|
lock: true,
|
|
text: '保存中,请等待',
|
|
spinner: 'el-icon-loading',
|
|
background: 'rgba(255, 255, 255, 0.7)'
|
|
});
|
|
goodsList = JSON.stringify(goodsList);
|
|
$.ajax({
|
|
url: "{:U('ModifyOperation')}",
|
|
type: "post",
|
|
data: {
|
|
goodsList: goodsList,
|
|
remarks: remarks,
|
|
modify_order_number: modify_order_number,
|
|
type: type
|
|
},
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
that.$message({
|
|
type: "success",
|
|
message: res.message,
|
|
duration: 1000,
|
|
onClose: function () {
|
|
loading_examine.close();
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
parent.layer.close(index);
|
|
}
|
|
})
|
|
} else {
|
|
that.$message({
|
|
type: "error",
|
|
message: res.message,
|
|
duration: 3000,
|
|
onClose: function () {
|
|
loading_examine.close();
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '已取消'
|
|
});
|
|
});
|
|
},
|
|
},
|
|
})
|
|
</script>
|
|
</html> |