354 行
12 KiB
HTML
可执行文件
354 行
12 KiB
HTML
可执行文件
<!DOCTYPE html>
|
||
<html>
|
||
<!--[1.0.77]-->
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>layui</title>
|
||
<meta name="renderer" content="webkit">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||
<link rel="stylesheet" href="__PUBLIC__/bootstrap/css/bootstrap.css">
|
||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css"/>
|
||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/goodsList.css"/>
|
||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/myscroll.css"/>
|
||
<style>
|
||
.gA_inner01 > span {
|
||
min-width: 66px;
|
||
}
|
||
|
||
.gA_inner01 > input {
|
||
margin-left: 10px;
|
||
}
|
||
|
||
.gA_inner02 {
|
||
margin-right: 0px;
|
||
}
|
||
|
||
.layui-table-box tr th .layui-form-checkbox {
|
||
display: none;
|
||
!important;
|
||
}
|
||
|
||
.layui-unselect {
|
||
width: 60px;
|
||
height: 24px;
|
||
line-height: 24px;
|
||
}
|
||
|
||
.addNew {
|
||
display: none;
|
||
}
|
||
|
||
.new-content {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
padding-top: 30px;
|
||
}
|
||
|
||
.new-content > input {
|
||
width: 200px;
|
||
padding: 5px 10px;
|
||
line-height: 28px;
|
||
border: 1px solid #ccc;
|
||
border-radius: 5px;
|
||
margin: 5px;
|
||
}
|
||
|
||
.layui-btn-1 {
|
||
background-color: white;
|
||
color: #999;
|
||
border: 1px solid #bbb;
|
||
}
|
||
|
||
.layui-btn-1:hover {
|
||
color: #009688;
|
||
border-color: #009688;
|
||
}
|
||
|
||
.layui-table th, .layui-table td {
|
||
text-align: center;
|
||
}
|
||
|
||
.attrInput {
|
||
border-color: transparent;
|
||
background-color: transparent;
|
||
width: 100%;
|
||
height: 100%;
|
||
padding: 0;
|
||
margin: 0;
|
||
text-align: center;
|
||
}
|
||
|
||
.attrInput:focus {
|
||
background-color: white;
|
||
}
|
||
|
||
.layui-input, .layui-table-edit {
|
||
width: 100%;
|
||
}
|
||
|
||
.status {
|
||
width: 44px;
|
||
height: 22px;
|
||
border-radius: 13px;
|
||
font-size: 12px;
|
||
border: 1px solid #ccc;
|
||
margin: 0 auto;
|
||
cursor: pointer;
|
||
position: relative;
|
||
transition: 0.3s;
|
||
}
|
||
|
||
.isOpen {
|
||
background-color: #009688;
|
||
border-color: #009688;
|
||
}
|
||
|
||
.isOpen:before {
|
||
content: '是';
|
||
color: white;
|
||
position: absolute;
|
||
left: 5px;
|
||
transform: scale(0.9);
|
||
}
|
||
.isOpen:after{
|
||
content: '';
|
||
background-color: white;
|
||
width: 15px;
|
||
height: 15px;
|
||
position: absolute;
|
||
top: 3px;
|
||
left: 22px;
|
||
border-radius: 50%;
|
||
transform: scale(0.9);
|
||
}
|
||
|
||
.isClose:before {
|
||
content: '否';
|
||
color: #aaa;
|
||
position: absolute;
|
||
left: 22px;
|
||
transform: scale(0.9);
|
||
}
|
||
.isClose:after{
|
||
content: '';
|
||
background-color: #bbb;
|
||
width: 15px;
|
||
height: 15px;
|
||
position: absolute;
|
||
top: 3px;
|
||
left: 5px;
|
||
border-radius: 50%;
|
||
transform: scale(0.9);
|
||
}
|
||
|
||
.addSku-btn {
|
||
display: inline-block;
|
||
width: 26px;
|
||
height: 26px;
|
||
color: #009688;
|
||
border: 1px solid #009688;
|
||
font-size: 24px;
|
||
font-weight: 100;
|
||
border-radius: 50%;
|
||
margin-left: 10px;
|
||
line-height: 24px;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.addSku-btn:active {
|
||
transform: scale(0.9);
|
||
}
|
||
|
||
th::selection, .addSku-btn::selection {
|
||
background-color: transparent;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div id="app" class="goodsBox">
|
||
<div class="goods_table">
|
||
<table class="layui-table">
|
||
<thead>
|
||
<colgroup>
|
||
<col width="80">
|
||
<col>
|
||
<col>
|
||
<col>
|
||
<col>
|
||
<col>
|
||
<col>
|
||
<col width="100">
|
||
<col width="150">
|
||
</colgroup>
|
||
<tr>
|
||
<th>序号</th>
|
||
<th>商品名称</th>
|
||
<th>货号</th>
|
||
<th>商品条码</th>
|
||
<th>商品库存</th>
|
||
<th>进价(元)</th>
|
||
<th>零售价(元)</th>
|
||
<th>商城价(元)</th>
|
||
<th>商城会员价(元)</th>
|
||
<th>是否称重</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody id="attrData">
|
||
<tr v-for="(list,index) in List">
|
||
<td>{{index+1*1}}</td>
|
||
<td>{{list.goods_name}}</td>
|
||
<td>
|
||
<input class="attrInput" :class="newIndex==index&&type==1?'layui-input layui-table-edit':''"
|
||
@focus="inputFocus(index,1)" @blur="inputBlur(index)" type="text" v-model="list.good_number">
|
||
</td>
|
||
<td>
|
||
<input class="attrInput" :class="newIndex==index&&type==2?'layui-input layui-table-edit':''"
|
||
@focus="inputFocus(index,2)" @blur="inputBlur(index)" type="text" v-model="list.goods_code">
|
||
</td>
|
||
<td>
|
||
<input class="attrInput" :class="newIndex==index&&type==3?'layui-input layui-table-edit':''"
|
||
@focus="inputFocus(index,3)" @blur="inputBlur(index)" type="text" v-model="list.goods_num">
|
||
</td>
|
||
<td>
|
||
<input class="attrInput" :class="newIndex==index&&type==4?'layui-input layui-table-edit':''"
|
||
@focus="inputFocus(index,4)" @blur="inputBlur(index)" type="text" v-model="list.purch_price">
|
||
</td>
|
||
<td>
|
||
<input class="attrInput" :class="newIndex==index&&type==5?'layui-input layui-table-edit':''"
|
||
@focus="inputFocus(index,5)" @blur="inputBlur(index)" type="text"
|
||
v-model="list.retail_price">
|
||
</td>
|
||
<td>
|
||
<input class="attrInput" :class="newIndex==index&&type==6?'layui-input layui-table-edit':''"
|
||
@focus="inputFocus(index,6)" @blur="inputBlur(index)" type="text"
|
||
v-model="list.online_price">
|
||
</td>
|
||
<td>
|
||
<span v-if="list.shop_mem_status==2">{{list.shop_mem_price}}</span>
|
||
<input v-else class="attrInput" :class="newIndex==index&&type==7?'layui-input layui-table-edit':''"
|
||
@focus="inputFocus(index,7)" @blur="inputBlur(index)" type="text"
|
||
v-model="list.shop_mem_price">
|
||
</td>
|
||
<td>
|
||
<div class="status" :class="list.can_exchange_weigh==2?'isOpen':'isClose'" @click="can_exchange_weigh(index)"></div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div style="display: flex;justify-content: center;margin-top: 50px;">
|
||
<div class="layui-btn" @click="save">保存</div>
|
||
</div>
|
||
</div>
|
||
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
|
||
<script src="__PUBLIC__/jquery/js/jquery.min.js"></script>
|
||
<script src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
|
||
<!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->
|
||
<script>
|
||
// var layer;
|
||
layui.use(['form', 'layer', 'table'], function () {
|
||
var layer = layui.layer;
|
||
})
|
||
var app = new Vue({
|
||
el: '#app',
|
||
data: function () {
|
||
return {
|
||
List: [],
|
||
inputClass: ['layui-table-edit', 'layui-input'],
|
||
newIndex: -1,
|
||
type: -1
|
||
}
|
||
},
|
||
methods: {
|
||
inputFocus: function (index, type) {
|
||
this.type = type;
|
||
this.newIndex = index;
|
||
this.List[index].class = ['layui-table-edit', 'layui-input'];
|
||
},
|
||
inputBlur: function (index) {
|
||
this.newIndex = -1;
|
||
this.type = -1;
|
||
},
|
||
save:function () {
|
||
var list = this.List;
|
||
if(list){
|
||
for (var i = 0; i < list.length; i++) {
|
||
var good_number = list[i].good_number;
|
||
if(!good_number){
|
||
layer.msg('第' + ++i + '条,商品货号未设置',{icon:2});
|
||
return;
|
||
}
|
||
|
||
if(list[i].goods_num < 0){
|
||
layer.msg('第' + ++i + '条,商品库存设置错误',{icon:2});
|
||
return;
|
||
}
|
||
var purch_price = parseInt(list[i].purch_price * 100);
|
||
if(purch_price <= 0){
|
||
layer.msg('第' + ++i + '条,商品进价设置错误',{icon:2});
|
||
return;
|
||
}
|
||
var retail_price = parseInt(list[i].retail_price * 100);
|
||
if(retail_price <= 0){
|
||
layer.msg('第' + ++i + '条,商品零售价设置错误',{icon:2});
|
||
return;
|
||
}
|
||
var online_price = parseInt(list[i].online_price * 100);
|
||
if(online_price <= 0){
|
||
layer.msg('第' + ++i + '条,商品商城价设置错误',{icon:2});
|
||
return;
|
||
}
|
||
var shop_mem_status = list[i].shop_mem_status;
|
||
if(shop_mem_status == 1){
|
||
var shop_mem_price = parseInt(list[i].shop_mem_price * 100);
|
||
if(shop_mem_price <= 0){
|
||
layer.msg('第' + ++i + '条,商品商城会员价设置错误',{icon:2});
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
$.ajax({
|
||
url: "{:U('edit_Price')}",
|
||
type: "post",
|
||
data: {
|
||
list: list
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
layer.msg(res.msg, {icon: 1, time: 1200})
|
||
} else if(res.status == 0 ) {
|
||
layer.msg(res.msg, {icon: 2, time: 5000})
|
||
}else{
|
||
layer.msg(res.msg, {time: 1500})
|
||
}
|
||
}
|
||
});
|
||
}else{
|
||
layer.msg('无数据',{icon:2});
|
||
return;
|
||
}
|
||
},
|
||
can_exchange_weigh:function(index){
|
||
if(this.List[index].can_exchange_weigh==1){
|
||
this.List[index].can_exchange_weigh = 2;
|
||
}else{
|
||
this.List[index].can_exchange_weigh = 1;
|
||
}
|
||
}
|
||
|
||
},
|
||
created: function () {
|
||
$.post("{:U('edit_getPrice')}", {ids: "{$ids}"}, function (res) {
|
||
if (res.data) {
|
||
app.List = res.data;
|
||
}
|
||
})
|
||
|
||
},
|
||
})
|
||
</script>
|
||
|
||
</body>
|
||
</html> |