304 行
12 KiB
HTML
可执行文件
304 行
12 KiB
HTML
可执行文件
<!DOCTYPE html>
|
|
<html>
|
|
<!--[1.2.91]-->
|
|
<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__/vue/element-ui.css">
|
|
<style>
|
|
.tip {
|
|
padding: 8px 16px;
|
|
background-color: #e6e6e6;
|
|
border-radius: 4px;
|
|
border-left: 5px solid #009688;
|
|
margin: 0px 0px 10px 0px;
|
|
}
|
|
.mem-div{
|
|
width: 100%;
|
|
display: flex;
|
|
}
|
|
.mem-price{
|
|
width: 70%;
|
|
}
|
|
.mem-status{
|
|
width: 20%;
|
|
margin-left: 5px;
|
|
}
|
|
.mem-status-switch{
|
|
margin: 10px auto;
|
|
}
|
|
.preservation{
|
|
display: flex;
|
|
justify-content: center;
|
|
margin-top: 20px;
|
|
}
|
|
.layui-btn {
|
|
display: inline-block;
|
|
height: 38px;
|
|
line-height: 38px;
|
|
padding: 0 18px;
|
|
background-color: #009688;
|
|
color: #fff;
|
|
white-space: nowrap;
|
|
text-align: center;
|
|
font-size: 14px;
|
|
border: none;
|
|
border-radius: 2px;
|
|
cursor: pointer;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="app" v-cloak style="width: 100%">
|
|
<div class="tip" style="font-size: 14px;">
|
|
<p><strong style="color: #009688;">称重商品</strong>货号建议长度最大为5,即小于等于99999,大于这个值的货号在称上无法识别</p>
|
|
<p><strong style="color: #009688;">规格商品</strong>信息请单独设置</p>
|
|
</div>
|
|
<template>
|
|
<el-table border :data="mgoods_list" style="width: 100%">
|
|
<el-table-column type="index" label="序号" width="50"></el-table-column>
|
|
<el-table-column prop="goods_name" label="商品名称">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.goods_name" style="width: 100%;height: 100%;"></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="good_number" label="商品货号">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.good_number"></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="goods_code" label="商品条码">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.goods_code"></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="can_exchange_weigh" label="是否称重" width="100">
|
|
<template slot-scope="scope">
|
|
<el-switch
|
|
v-model="scope.row.can_exchange_weigh"
|
|
active-value="2"
|
|
inactive-value="1"
|
|
active-color="#009688">
|
|
</el-switch>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="retail_price" label="店内零售价">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.retail_price" ></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column type="online_price" label="商城零售价">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.online_price"></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="store_mem_price" label="店内会员价" min-width="120">
|
|
<template slot-scope="scope">
|
|
<div class="mem-div">
|
|
<div class="mem-price">
|
|
<el-input v-model="scope.row.store_mem_price" :disabled="scope.row.store_mem_status == 1 ? false : true"></el-input>
|
|
</div>
|
|
<div class="mem-status">
|
|
<el-switch
|
|
v-model="scope.row.store_mem_status"
|
|
active-value="1"
|
|
inactive-value="2"
|
|
active-color="#009688"
|
|
class="mem-status-switch">
|
|
</el-switch>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="shop_mem_price" label="商城会员价" min-width="120">
|
|
<template slot-scope="scope">
|
|
<div class="mem-div">
|
|
<div class="mem-price">
|
|
<el-input v-model="scope.row.shop_mem_price" :disabled="scope.row.shop_mem_status == 1 ? false : true"></el-input>
|
|
</div>
|
|
<div class="mem-status">
|
|
<el-switch
|
|
v-model="scope.row.shop_mem_status"
|
|
active-value="1"
|
|
inactive-value="2"
|
|
active-color="#009688"
|
|
class="mem-status-switch">
|
|
</el-switch>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="attribute_name" label="规格" width="70"></el-table-column>
|
|
<el-table-column fixed="right" label="操作" width="80" style="border-right: none;">
|
|
<template slot-scope="scope">
|
|
<el-button style="color: #009688" type="text" size="small" @click="remove_goods(scope.$index)">移除</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div class="preservation">
|
|
<div class="layui-btn" @click="preservation">批量保存</div>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</body>
|
|
<script src="__PUBLIC__/jquery/js/jquery-3.2.1.min.js"></script>
|
|
<script src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
|
|
<script src="__PUBLIC__/vue/element-ui.js"></script>
|
|
<script>
|
|
var app = new Vue({
|
|
el: '#app',
|
|
data: function () {
|
|
return {
|
|
ids: "{$ids}", // 批量修改的商品id
|
|
mgoods_list: [], // 商品列表
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
/* 获取选中的商品数据 */
|
|
get_mgoods_list(){
|
|
var that = this;
|
|
$.ajax({
|
|
url:"get_update_mgoods_list_two",
|
|
type:"post",
|
|
data:{ids:that.ids},
|
|
success:function (res) {
|
|
if(res.status == 1){
|
|
that.mgoods_list = res.mgoods_list;
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
/* 移除商品 */
|
|
remove_goods(index) {
|
|
var that = this;
|
|
var mgoods_list = that.mgoods_list;
|
|
that.$confirm('确定移除该商品吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
mgoods_list.splice(index, 1);
|
|
that.mgoods_list = mgoods_list;
|
|
});
|
|
},
|
|
|
|
/* 批量保存 */
|
|
preservation(){
|
|
var that = this;
|
|
var mgoods_list = that.mgoods_list;
|
|
if(!mgoods_list){
|
|
this.$message({
|
|
showClose: true,
|
|
message: '修改数据缺失',
|
|
type: 'warning'
|
|
});
|
|
return false;
|
|
}
|
|
for (var i = 0; i < mgoods_list.length; i++) {
|
|
if(!mgoods_list[i].goods_name){
|
|
that.$message({
|
|
showClose: true,
|
|
message: '第' + (i+1) + '条商品名称不正确',
|
|
type: 'warning'
|
|
});
|
|
return false;
|
|
}
|
|
if(!mgoods_list[i].good_number){
|
|
that.$message({
|
|
showClose: true,
|
|
message: '第' + (i+1) + '条商品货号不正确',
|
|
type: 'warning'
|
|
});
|
|
return false;
|
|
}
|
|
if(!mgoods_list[i].goods_num && mgoods_list[i].goods_num === ''){
|
|
that.$message({
|
|
showClose: true,
|
|
message: '第' + (i+1) + '条商品库存不正确',
|
|
type: 'warning'
|
|
});
|
|
return false;
|
|
}
|
|
if(!mgoods_list[i].retail_price || mgoods_list[i].retail_price < 0){
|
|
that.$message({
|
|
showClose: true,
|
|
message: '第' + (i+1) + '条商品进价不正确',
|
|
type: 'warning'
|
|
});
|
|
return false;
|
|
}
|
|
if(!mgoods_list[i].retail_price || mgoods_list[i].retail_price < 0){
|
|
that.$message({
|
|
showClose: true,
|
|
message: '第' + (i+1) + '条店内零售价不正确',
|
|
type: 'warning'
|
|
});
|
|
return false;
|
|
}
|
|
if(!mgoods_list[i].online_price || mgoods_list[i].online_price < 0){
|
|
that.$message({
|
|
showClose: true,
|
|
message: '第' + (i+1) + '条商城零售价不正确',
|
|
type: 'warning'
|
|
});
|
|
return false;
|
|
}
|
|
if(mgoods_list[i].store_mem_status == 1){
|
|
if(!mgoods_list[i].store_mem_price || mgoods_list[i].store_mem_price < 0){
|
|
that.$message({
|
|
showClose: true,
|
|
message: '第' + (i+1) + '条店内会员价不正确',
|
|
type: 'warning'
|
|
});
|
|
return false;
|
|
}
|
|
}
|
|
if(mgoods_list[i].shop_mem_status == 1){
|
|
if(!mgoods_list[i].shop_mem_price || mgoods_list[i].shop_mem_price < 0){
|
|
that.$message({
|
|
showClose: true,
|
|
message: '第' + (i+1) + '条商城会员价不正确',
|
|
type: 'warning'
|
|
});
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
$.ajax({
|
|
url:"{:U('batch_save_mgoods_two')}",
|
|
type:'post',
|
|
data:{mgoods_list:mgoods_list},
|
|
success:function (res) {
|
|
if(res.status == 1){
|
|
that.$message({
|
|
showClose: true,
|
|
message: res.msg,
|
|
type: 'success'
|
|
});
|
|
}else{
|
|
that.$message({
|
|
showClose: true,
|
|
message: res.msg,
|
|
type: 'error'
|
|
});
|
|
return false;
|
|
}
|
|
}
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created:function () {
|
|
this.get_mgoods_list();
|
|
}
|
|
});
|
|
</script>
|
|
|
|
</html> |