140 lines
4.7 KiB
HTML
140 lines
4.7 KiB
HTML
<style>
|
|
.member-select {
|
|
position: absolute;
|
|
left: 400px;
|
|
top: 175px;
|
|
}
|
|
.member-select-add{
|
|
border:1px solid #ff6a00;
|
|
padding: 5px 10px;
|
|
}
|
|
.layui-unselect.layui-form-radio.layui-form-radioed i:after {
|
|
width: 0 !important;
|
|
height: 0 !important;
|
|
}
|
|
.layui-table-body {
|
|
max-height: 530px;
|
|
}
|
|
.inline{width: 205px;}
|
|
.layui-input{width: 205px;}
|
|
.layui-btn-primary1{height: 32px; line-height: 32px; position: absolute; right: 1px; top: 1px; border-width: 0; border-left-width: 1px;}
|
|
</style>
|
|
<div class="layui-card card-brief">
|
|
<div class="layui-form-item">
|
|
<button class="layui-btn layui-btn" onclick="addSite()">复制商品</button>
|
|
</div>
|
|
</div>
|
|
<script type="text/html" id="addSite">
|
|
<div class="layui-form">
|
|
<div class="layui-input-inline inline">
|
|
<input type="text" name="site_search" placeholder="请输入商品名称" autocomplete="off" class="layui-input ">
|
|
<button type="button" class="layui-btn layui-btn-primary1 member-search" lay-filter="search" lay-submit>
|
|
<i class="layui-icon"></i>
|
|
</button>
|
|
</div>
|
|
<table id="site_list" lay-filter="site_list"></table>
|
|
</div>
|
|
</script>
|
|
<script type="text/javascript">
|
|
var form, laydate, laytpl;
|
|
layui.use(['form', 'upload', 'util', 'laytpl'], function () {
|
|
form = layui.form;
|
|
laytpl = layui.laytpl;
|
|
form.render();
|
|
});
|
|
let site_id = "{$siteInfo.site_id??''}";
|
|
let add_attr_radioState2 = 0;
|
|
let new_site_id = '';
|
|
let username = '';
|
|
function addSite() {
|
|
let _this = this;
|
|
var add_attr2 = $("#addSite").html();
|
|
$("#auth_show").hide();
|
|
form.on('radio(laymemberid)', function (obj) {
|
|
new_site_id = obj.value;
|
|
username = obj.elem.attributes.data.value;
|
|
_this.add_attr_radioState2 = obj.value;
|
|
});
|
|
laytpl(add_attr2).render({}, function (html) {
|
|
add_attr_index2 = layer.open({
|
|
title: '选择商品',
|
|
skin: 'layer-tips-class',
|
|
type: 1,
|
|
area: ['50%', '80%'],
|
|
content: html,
|
|
btn: ["复制", "返回"],
|
|
yes: function () {
|
|
var value = $('input[type=radio]:checked').prop('value');
|
|
if(!value){
|
|
layer.msg('请选择需要复制的商品');
|
|
return false;
|
|
}
|
|
$.ajax({
|
|
url: ns.url("shop/goods/copySiteGoods"),
|
|
dataType: 'JSON',
|
|
type: 'POST',
|
|
data: {copy_id:value},
|
|
success: function(res){
|
|
layer.msg(res.message);
|
|
layer.close(add_attr_index2);
|
|
window.parent.location.reload();
|
|
}
|
|
})
|
|
}
|
|
});
|
|
});
|
|
//展示已知数据
|
|
table = new Table({
|
|
elem: '#site_list',
|
|
url: ns.url("shop/goods/copyGoodsList"),
|
|
data: {isBingSite: 'NO'},
|
|
cols: [
|
|
[
|
|
{
|
|
width: "20%",
|
|
title: '商品选择',
|
|
unresize: 'false',
|
|
templet: function (data) {
|
|
var html = '';
|
|
html += `
|
|
<div class="radio">
|
|
<input type="radio" name="layTableRadioc" value="${data.goods_id}" data="${data.goods_name}" lay-type="layTableRadio" lay-filter="laymemberid">
|
|
</div>
|
|
`;
|
|
return html;
|
|
}
|
|
},
|
|
{
|
|
title: '商品名称',
|
|
width: '60%',
|
|
field: 'goods_name',
|
|
unresize: 'false'
|
|
},
|
|
{
|
|
title: '商品种类',
|
|
width: '20%',
|
|
field: 'goods_class_name',
|
|
unresize: 'false'
|
|
},
|
|
]
|
|
],
|
|
});
|
|
/**
|
|
* 搜索功能
|
|
*/
|
|
form.on('submit(search)', function (data) {
|
|
table.reload({
|
|
page: {
|
|
curr: 1
|
|
},
|
|
where: data.field
|
|
});
|
|
});
|
|
$(document).keydown(function (event) {
|
|
if (event.keyCode == 13) {
|
|
$(".site-search").trigger("click");
|
|
}
|
|
});
|
|
}
|
|
</script>
|