chore: src/app 目录与华为云第一台服务器上的代码做第一次比较合并
This commit is contained in:
@@ -123,11 +123,12 @@ class BaseShop extends Controller
|
||||
$config_view = Config::get('view');
|
||||
$config_view[ 'tpl_replace_string' ] = array_merge($config_view[ 'tpl_replace_string' ], $this->replace);
|
||||
Config::set($config_view, 'view');
|
||||
// 其他操作
|
||||
|
||||
if (!request()->isAjax()) {
|
||||
$this->initBaseInfo();
|
||||
$this->loadTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1907,6 +1907,7 @@ class Goods extends BaseShop
|
||||
if ($data[ 'code' ] < 0) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$result = ( new GoodsImport() )->importGoods($data[ 'data' ], $this->site_id, $type);
|
||||
return $result;
|
||||
} else {
|
||||
|
||||
@@ -35,6 +35,7 @@ class Index extends BaseShop
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->assign('shop_status', 1);
|
||||
|
||||
$this->handlePromotion();
|
||||
|
||||
@@ -25,6 +25,62 @@ use addon\coupon\model\Coupon as CouponModel;
|
||||
*/
|
||||
class Member extends BaseShop
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
public function business(){
|
||||
|
||||
$member = new MemberModel();
|
||||
if (request()->isJson()) {
|
||||
$page = input('page', 1);
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
$search_text = input('search_keys', '');
|
||||
|
||||
$condition = [];
|
||||
if (!empty($search_text)) {
|
||||
$condition[] = [ 'name', 'like', '%' . $search_text . '%' ];
|
||||
}
|
||||
|
||||
return $member->getBusinessPageList($condition, $page, $page_size,'id desc');
|
||||
} else {
|
||||
return $this->fetch('member/business');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑
|
||||
*/
|
||||
public function businesspost()
|
||||
{
|
||||
$member = new MemberModel();
|
||||
if (request()->isJson()) {
|
||||
$id = input('id', 0);
|
||||
$data = [
|
||||
'realname' => input('realname', ''),
|
||||
];
|
||||
if($id>0){
|
||||
$res = model('business')->update($data,['id'=>$id]);
|
||||
}else{
|
||||
$res = model('business')->add($data);
|
||||
}
|
||||
return $member->success($res);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function businessdelete()
|
||||
{
|
||||
$member = new MemberModel();
|
||||
if (request()->isJson()) {
|
||||
$id = input('id', 0);
|
||||
$result = model('business')->delete([['id', '=', $id]]);
|
||||
return $member->success($result);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 会员概况
|
||||
*/
|
||||
|
||||
@@ -104,7 +104,7 @@ class Order extends BaseShop
|
||||
a.invoice_type,a.invoice_title,a.taxpayer_number,a.invoice_rate,a.invoice_content,a.invoice_delivery_money,a.invoice_full_address,a.is_tax_invoice,a.invoice_email,a.invoice_title_type,a.is_fenxiao,
|
||||
a.point_money,a.member_card_money,a.member_card_order,a.invoice_status,a.invoice_remark,a.invoice_code,a.invoice_image,a.invoice_time,a.predict_delivery_time,a.is_video_number,a.close_cause,
|
||||
a.cashier_order_type,a.cashier_sell_time,a.cashier_operator_id,a.cashier_operator_name,a.balance,a.total_balance,a.store_id,a.reduction,a.round_money,a.order_scene,
|
||||
a.store_commission_rate,a.store_commission,s.store_name,a.merch_id';
|
||||
a.store_commission_rate,a.store_commission,s.store_name,a.merch_id,a.business';
|
||||
$order_common_model = new OrderCommonModel();
|
||||
if (request()->isJson()) {
|
||||
$page_index = input('page', 1);
|
||||
|
||||
@@ -548,6 +548,30 @@
|
||||
|
||||
<!-- 商品详情 -->
|
||||
<div class="layui-tab-item">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label short-label"><span class="required">*</span>PDF标题:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="pdf_name" value="{$goods_info.pdf_name}" maxlength="40" autocomplete="off" placeholder="请输入PDF标题" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>PDF文件:</label>
|
||||
<div class="layui-input-block">
|
||||
<p class="file-upload">{if $goods_info.pdf_url}<a href="{:img($goods_info.pdf_url)}" target="_blank" style="color:#4390FF">查看文件</a>{else}未上传{/if}</p>
|
||||
<button type="button" class="layui-btn" id="cert_upload">
|
||||
<i class="layui-icon"></i>
|
||||
选择PDF文件
|
||||
</button>
|
||||
<input type="hidden" name="pdf_url" class="layui-input len-long" value="{$info.pdf_url ?? ''}" lay-verify="pdf_url">
|
||||
</div>
|
||||
<div class="word-aux">请选择pdf文件</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm"></label>
|
||||
<div class="layui-input-inline special-length">
|
||||
@@ -1057,7 +1081,7 @@
|
||||
<script src="__STATIC__/ext/video/videojs-ie8.min.js"></script>
|
||||
<script src="__STATIC__/ext/video/video.min.js"></script>
|
||||
<script src="__STATIC__/ext/searchable_select/searchable_select.js"></script>
|
||||
<script src="SHOP_JS/goods_edit_common.js?v=4"></script>
|
||||
<script src="SHOP_JS/goods_edit_common.js?v={$version}"></script>
|
||||
<script src="SHOP_JS/goods_edit.js"></script>
|
||||
<script src="SHOP_JS/category_select.js"></script>
|
||||
|
||||
|
||||
272
src/app/shop/view/member/business.html
Normal file
272
src/app/shop/view/member/business.html
Normal file
@@ -0,0 +1,272 @@
|
||||
<style>
|
||||
.layui-layer-content {padding-bottom: 20px!important;}
|
||||
</style>
|
||||
<!-- 搜索框 -->
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="addLabel()">添加姓名</button>
|
||||
<!-- <div class="layui-form">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="search_keys" placeholder="请输入姓名名称" autocomplete="off" class="layui-input" maxlength="10">
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
|
||||
<i class="layui-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
<table id="attr_class_list" lay-filter="attr_class_list"></table>
|
||||
|
||||
<!-- 编辑排序 -->
|
||||
<script type="text/html" id="editSort">
|
||||
<input name="sort" type="number" onchange="editSort({{d.id}}, this)" value="{{d.sort}}" class="layui-input edit-sort len-short">
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="addLabel">
|
||||
|
||||
<div class="layui-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>姓名:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="realname" type="text" placeholder="请输入" lay-verify="required" class="layui-input len-mid" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row mid">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closeAttrLayer()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="editLabel">
|
||||
|
||||
<div class="layui-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>姓名:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="realname" type="text" value="{{ d.realname }}" placeholder="请输入" lay-verify="required" class="layui-input len-mid" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" value="{{ d.id }}">
|
||||
<div class="form-row mid">
|
||||
<button class="layui-btn" lay-submit lay-filter="edit_save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closeAttrLayer()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var laytpl, add_attr_index = -1,
|
||||
form, table;
|
||||
layui.use(['form', 'laytpl'], function() {
|
||||
var repeat_flag = false; //防重复标识
|
||||
laytpl = layui.laytpl;
|
||||
form = layui.form;
|
||||
form.render();
|
||||
|
||||
table = new Table({
|
||||
elem: '#attr_class_list',
|
||||
url: ns.url("shop/member/business"),
|
||||
cols: [
|
||||
[ {
|
||||
field: 'realname',
|
||||
title: '姓名',
|
||||
unresize: 'false'
|
||||
},{
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit':
|
||||
editLabel(data);
|
||||
break;
|
||||
case 'delete':
|
||||
deleteLabel(data.id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
table.on("sort",function (obj) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
order:obj.field,
|
||||
sort:obj.type
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function deleteLabel(id) {
|
||||
layer.confirm('确认删除吗?', function(index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("shop/member/businessdelete"),
|
||||
data: {
|
||||
id:id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function(data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
|
||||
form.on('submit(save)', function(data) {
|
||||
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: '{:addon_url("shop/member/businesspost")}',
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(data) {
|
||||
layer.msg(data.message);
|
||||
if (data.code == 0) {
|
||||
table.reload();
|
||||
layer.close(add_attr_index);
|
||||
}
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
form.on('submit(edit_save)', function(data) {
|
||||
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: '{:addon_url("shop/member/businesspost")}',
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(data) {
|
||||
layer.msg(data.message);
|
||||
if (data.code == 0) {
|
||||
table.reload();
|
||||
layer.close(add_attr_index);
|
||||
}
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
num: function(value) {
|
||||
if (value == '') {
|
||||
return;
|
||||
}
|
||||
if (value % 1 != 0) {
|
||||
return '排序数值必须为整数';
|
||||
}
|
||||
if (value < 0) {
|
||||
return '排序数值必须为大于0';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function addLabel() {
|
||||
var add_attr = $("#addLabel").html();
|
||||
laytpl(add_attr).render({}, function(html) {
|
||||
add_attr_index = layer.open({
|
||||
title: '添加姓名',
|
||||
skin: 'layer-tips-class',
|
||||
type: 1,
|
||||
area: ['500px', '300px'],
|
||||
content: html,
|
||||
success: function() {
|
||||
layui.use('form', function() {
|
||||
var form = layui.form;
|
||||
form.render('select');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function editLabel(data) {
|
||||
var add_attr = $("#editLabel").html();
|
||||
laytpl(add_attr).render(data, function(html) {
|
||||
add_attr_index = layer.open({
|
||||
title: '编辑姓名',
|
||||
skin: 'layer-tips-class',
|
||||
type: 1,
|
||||
area: ['500px', '300px'],
|
||||
content: html,
|
||||
success: function() {
|
||||
layui.use('form', function() {
|
||||
var form = layui.form;
|
||||
form.render('select');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// laytpl(add_attr).render(data, function(html) {
|
||||
// add_attr_index = layer.open({
|
||||
// title: '编辑姓名',
|
||||
// skin: 'layer-tips-class',
|
||||
// type: 1,
|
||||
// area: ['500px', '300px'],
|
||||
// content: html
|
||||
// });
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
function closeAttrLayer() {
|
||||
layer.close(add_attr_index);
|
||||
}
|
||||
</script>
|
||||
@@ -130,7 +130,7 @@
|
||||
<!-- 主动退款 -->
|
||||
{include file="order/shop_active_refund" /}
|
||||
|
||||
<script src="SHOP_JS/order_list.js?v=3"></script>
|
||||
<script src="SHOP_JS/order_list.js?v=5"></script>
|
||||
<script src="SHOP_JS/lodop_funcs.js"></script>
|
||||
<script>
|
||||
var laypage,element, form;
|
||||
|
||||
@@ -313,6 +313,9 @@ Order.prototype.tbody = function () {
|
||||
if (order.buyer_ask_delivery_time != '' && order.buyer_ask_delivery_time != 0) tbody += '<span class="order-item-header" style="margin-left:50px;">要求送达时间:' + (order.buyer_ask_delivery_time.indexOf('-') != -1 ? order.buyer_ask_delivery_time : ns.time_to_date(order.buyer_ask_delivery_time) ) + '</span>';
|
||||
else tbody += '<span class="order-item-header" style="margin-left:50px;">要求送达时间:立即送达</span>';
|
||||
}
|
||||
|
||||
if (order.business) tbody += '<span class="order-item-header" style="color:red;">业务员:' + order.business +'</span>';
|
||||
|
||||
tbody += '</td>';
|
||||
tbody += '<td colspan="2">';
|
||||
tbody += '<div class="table-btn order-list-top-line" style="align:right;">';
|
||||
|
||||
375
src/app/shop/view/seal/medium.html
Normal file
375
src/app/shop/view/seal/medium.html
Normal file
@@ -0,0 +1,375 @@
|
||||
|
||||
|
||||
<style>
|
||||
.layui-layer-content {padding-bottom: 20px!important;}
|
||||
.layui-table-cell, .layui-table-tool-panel li {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: normal;
|
||||
}
|
||||
.layui-table-view .layui-table[lay-size=lg] .layui-table-cell {
|
||||
line-height: 20px;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<!-- <div class="single-filter-box">
|
||||
<button class="layui-btn" id="product_file">导入介质材料</button>
|
||||
<div class="layui-form">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="search_keys" placeholder="标签组名称" autocomplete="off" class="layui-input" maxlength="10">
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
|
||||
<i class="layui-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- 列表 -->
|
||||
<table id="attr_class_list" lay-filter="attr_class_list"></table>
|
||||
|
||||
<!-- 编辑排序 -->
|
||||
<script type="text/html" id="editSort">
|
||||
<input name="sort" type="number" onchange="editSort({{d.id}}, this)" value="{{d.sort}}" class="layui-input edit-sort len-short">
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="addLabel">
|
||||
|
||||
<div class="layui-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>标签组名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="label_name" type="text" placeholder="标签组名称" lay-verify="required" class="layui-input len-mid" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row mid">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closeAttrLayer()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="editLabel">
|
||||
|
||||
<div class="layui-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>标签组名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="label_name" type="text" value="{{ d.label_name }}" placeholder="标签组名称" lay-verify="required" class="layui-input len-mid" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" value="{{ d.id }}">
|
||||
<div class="form-row mid">
|
||||
<button class="layui-btn" lay-submit lay-filter="edit_save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closeAttrLayer()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var laytpl, add_attr_index = -1,
|
||||
form, table;
|
||||
layui.use(['form', 'laytpl'], function() {
|
||||
var repeat_flag = false; //防重复标识
|
||||
laytpl = layui.laytpl;
|
||||
form = layui.form;
|
||||
form.render();
|
||||
|
||||
table = new Table({
|
||||
elem: '#attr_class_list',
|
||||
url: ns.url("shop/seal/medium"),
|
||||
cols: [
|
||||
[ {
|
||||
field: 'name',
|
||||
title: '介质',
|
||||
width:'8%',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'FFKM',
|
||||
title: 'FFKM',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'FEPM',
|
||||
title: 'FEPM',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'SBR',
|
||||
title: 'SBR',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'CR',
|
||||
title: 'CR',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'PTFE&PFA',
|
||||
title: 'PTFE&PFA',
|
||||
width:'7%',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'EPDM',
|
||||
title: 'EPDM',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'ECO',
|
||||
title: 'ECO',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'ⅡR',
|
||||
title: 'ⅡR',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'NBR',
|
||||
title: 'NBR',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'ACM',
|
||||
title: 'ACM',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'PU',
|
||||
title: 'PU',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'NR',
|
||||
title: 'NR',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'FKM',
|
||||
title: 'FKM',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'AEM',
|
||||
title: 'AEM',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'HNBR',
|
||||
title: 'HNBR',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'FVMQ',
|
||||
title: 'FVMQ',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'CSM',
|
||||
title: 'CSM',
|
||||
unresize: 'false'
|
||||
},{
|
||||
field: 'VMQ',
|
||||
title: 'VMQ',
|
||||
unresize: 'false'
|
||||
},
|
||||
|
||||
// {
|
||||
// title: '操作',
|
||||
// toolbar: '#operation',
|
||||
// unresize: 'false',
|
||||
// align : 'right'
|
||||
// }
|
||||
]]
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit':
|
||||
editLabel(data);
|
||||
break;
|
||||
case 'delete':
|
||||
deleteLabel(data.id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
table.on("sort",function (obj) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
order:obj.field,
|
||||
sort:obj.type
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function deleteLabel(id) {
|
||||
layer.confirm('确认删除该标签吗?', function(index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("shop/goodslabel/delete"),
|
||||
data: {
|
||||
id:id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function(data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
|
||||
form.on('submit(save)', function(data) {
|
||||
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: '{:addon_url("shop/goodslabel/add")}',
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(data) {
|
||||
layer.msg(data.message);
|
||||
if (data.code == 0) {
|
||||
table.reload();
|
||||
layer.close(add_attr_index);
|
||||
}
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
form.on('submit(edit_save)', function(data) {
|
||||
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: '{:addon_url("shop/goodslabel/edit")}',
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(data) {
|
||||
layer.msg(data.message);
|
||||
if (data.code == 0) {
|
||||
table.reload();
|
||||
layer.close(add_attr_index);
|
||||
}
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
num: function(value) {
|
||||
if (value == '') {
|
||||
return;
|
||||
}
|
||||
if (value % 1 != 0) {
|
||||
return '排序数值必须为整数';
|
||||
}
|
||||
if (value < 0) {
|
||||
return '排序数值必须为大于0';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function addLabel() {
|
||||
var add_attr = $("#addLabel").html();
|
||||
laytpl(add_attr).render({}, function(html) {
|
||||
add_attr_index = layer.open({
|
||||
title: '添加标签组',
|
||||
skin: 'layer-tips-class',
|
||||
type: 1,
|
||||
area: ['500px', '200px'],
|
||||
content: html
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function editLabel(data) {
|
||||
var add_attr = $("#editLabel").html();
|
||||
laytpl(add_attr).render(data, function(html) {
|
||||
add_attr_index = layer.open({
|
||||
title: '编辑标签组',
|
||||
skin: 'layer-tips-class',
|
||||
type: 1,
|
||||
area: ['500px', '300px'],
|
||||
content: html
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function closeAttrLayer() {
|
||||
layer.close(add_attr_index);
|
||||
}
|
||||
|
||||
// 监听单元格编辑
|
||||
function editSort(id, event){
|
||||
var data = $(event).val();
|
||||
|
||||
if (data == '') {
|
||||
$(event).val(0);
|
||||
data = 0;
|
||||
}
|
||||
|
||||
if(!new RegExp("^-?[0-9]\\d*$").test(data)){
|
||||
layer.msg("排序号只能是整数");
|
||||
return ;
|
||||
}
|
||||
if(data<0){
|
||||
layer.msg("排序号必须大于0");
|
||||
return ;
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ns.url("shop/goodslabel/modifySort"),
|
||||
data: {
|
||||
sort: data,
|
||||
id: id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if(res.code==0){
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
120
src/app/shop/view/seal/mediumimport.html
Normal file
120
src/app/shop/view/seal/mediumimport.html
Normal file
@@ -0,0 +1,120 @@
|
||||
|
||||
<style>
|
||||
.single-filter-box {justify-content: left;line-height: 34px}
|
||||
.single-filter-box a{cursor:pointer;margin-left: 10px}
|
||||
</style>
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" id="product_file">导入介质材料</button>
|
||||
<!-- <a class="layui-btn layui-btn-primary" onclick="downloadMemberFile()">点击下载模板</a> -->
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
<table id="product_import_log_list" lay-filter="product_import_log_list"></table>
|
||||
<!-- 工具栏操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="info">查看</a>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var table,upload,repeat_flag = false;
|
||||
layui.use(['form', 'laydate','laytpl', 'upload'], function() {
|
||||
var form = layui.form,
|
||||
laydate = layui.laydate,
|
||||
currentDate = new Date(),
|
||||
laytpl = layui.laytpl,
|
||||
minDate = "";
|
||||
upload = layui.upload;
|
||||
form.render();
|
||||
/**
|
||||
* 表格加载
|
||||
*/
|
||||
table = new Table({
|
||||
elem: '#product_import_log_list',
|
||||
url: ns.url("shop/seal/mediumimport"),
|
||||
cols: [
|
||||
[{
|
||||
field: 'create_time',
|
||||
title: '导入时间',
|
||||
width: '20%',
|
||||
unresize: 'false',
|
||||
}, {
|
||||
field: 'member_num',
|
||||
title: '导入数量',
|
||||
width: '20%',
|
||||
unresize: 'false',
|
||||
}, /*{
|
||||
field: 'success_num',
|
||||
title: '导入成功',
|
||||
width: '20%',
|
||||
unresize: 'false',
|
||||
}, {
|
||||
field: 'error_num',
|
||||
title: '导入失败',
|
||||
width: '15%',
|
||||
unresize: 'false',
|
||||
}, */
|
||||
/*{
|
||||
title: '操作',
|
||||
unresize: 'false',
|
||||
toolbar: '#operation',
|
||||
align : 'right'
|
||||
}*/
|
||||
]
|
||||
]
|
||||
});
|
||||
//允许上传的文件后缀
|
||||
upload.render({
|
||||
elem: '#product_file'
|
||||
,url: ns.url("shop/seal/mediumFile"),
|
||||
accept:'file',
|
||||
acceptMime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
exts: 'xlsx',
|
||||
done: function(res){
|
||||
if (res.code >= 0) {
|
||||
product_import(1, res.data.name, res.data.path);
|
||||
repeat_flag = false;
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function product_import(index, name, path, success_num = 0, error_num = 0, record = 0){
|
||||
$.ajax({
|
||||
url: ns.url("shop/seal/startMediumImport"),
|
||||
data: {
|
||||
filename: name,
|
||||
path: path,
|
||||
index: index,
|
||||
success_num : success_num,
|
||||
error_num : error_num,
|
||||
record : record
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
index ++;
|
||||
if(res.code == 0){
|
||||
|
||||
if(res.data.num < res.data.allRow){
|
||||
product_import(index, res.data.name, res.data.path, res.data.success_num, res.data.error_num, res.data.record);
|
||||
}else{
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
if(res.data.error_num > 0) {
|
||||
layer.msg('导入失败');
|
||||
} else {
|
||||
layer.msg('导入成功');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function downloadMemberFile(){
|
||||
location.href = ns.url("shop/member/downloadMemberFile");
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
258
src/app/shop/view/seal/structure.html
Normal file
258
src/app/shop/view/seal/structure.html
Normal file
@@ -0,0 +1,258 @@
|
||||
<style>
|
||||
.table_body{font-family: arial;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}
|
||||
.goods-category-list .layui-table td{border-left: 0;border-right: 0;}
|
||||
.goods-category-list .layui-table .switch{font-size: 16px;cursor: pointer;width: 12px;line-height: 1;display: inline-block;text-align: center;vertical-align: middle;}
|
||||
.goods-category-list .layui-table img{width: 40px;}
|
||||
.table_div{color:#666}
|
||||
.table_head{display: flex;font-weight: bold;background-color: #F7F7F7;}
|
||||
.table_head li{height: 50px;line-height: 50px;border: 0;padding: 0 22px;font-size: 14px;}
|
||||
.table_head .operate{text-align: right;}
|
||||
.table_head li:first-child{padding-right: 0;}
|
||||
/* 统一所有层级的行样式 */
|
||||
.category-item{display: flex;border-bottom: 1px solid #e6e6e6;background: #fff;height: 52px !important;}
|
||||
.category-item .table_td{position: relative;padding: 11px 22px 8px;min-height: 30px;line-height: 33px;font-size: 14px;}
|
||||
.category-item .table_td span{cursor: pointer;}
|
||||
.category-item .table_td span>img{width:12px;height:12px}
|
||||
.category-item .table_td .img-box{width:30px;height:30px;line-height: 30px;}
|
||||
.category-item .table_td:first-child{padding-right:0}
|
||||
.category-item .table-btn{display: flex;flex-wrap: wrap;justify-content: flex-end;}
|
||||
.category-item .layui-btn{display: flex;justify-content: center;align-items: center;height: 23px;border-radius: 50px;background-color: transparent;color: var(--base-color);text-align: center;padding: 2px 0;margin: 5px 0 5px 10px;position: relative;}
|
||||
/* 子分类容器:默认隐藏 */
|
||||
.child-category-container{display: none;margin-left: 20px;}
|
||||
.empty_switch{display: inline-block;width:30px;height:25px;padding-right:15px;}
|
||||
.js-switch{display: inline-block;height:30px;width:30px;text-align: center;}
|
||||
/* 拖拽图标:动态缩进 */
|
||||
.drag-icon{cursor: move;display: inline-block;margin-right: 10px;}
|
||||
|
||||
/* 1. 修复:拖拽+展开按钮的容器布局(用Flex统一对齐) */
|
||||
.category-item .table_td:first-child { /* 第一个单元格:拖拽+展开按钮的容器 */
|
||||
/* display: flex; */
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
width: 20px !important;
|
||||
padding-left: 5px !important;
|
||||
}
|
||||
|
||||
/* 2. 修复:拖拽图标的尺寸和间距(固定宽高,避免挤压按钮) */
|
||||
.drag-icon {
|
||||
cursor: move;
|
||||
display: inline-flex; /* 让图标本身垂直居中 */
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 20px; /* 固定宽度,避免不同层级尺寸变化 */
|
||||
height: 20px; /* 固定高度,确保垂直对齐 */
|
||||
margin-right: 8px; /* 与+号按钮的固定间距,避免水平错位 */
|
||||
}
|
||||
|
||||
/* 3. 修复:展开/收起按钮的尺寸和对齐(固定宽高,强制居中) */
|
||||
.js-switch, .empty_switch {
|
||||
display: inline-flex; /* 按钮内文字垂直居中 */
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 20px; /* 固定宽度,所有层级按钮一样大 */
|
||||
height: 20px; /* 固定高度,避免垂直拉伸 */
|
||||
padding: 0 !important; /* 清除默认padding,避免错位 */
|
||||
margin: 0 !important; /* 清除默认margin */
|
||||
line-height: 1; /* 重置行高,避免文字上下偏移 */
|
||||
}
|
||||
|
||||
/* 4. 修复:子分类容器的缩进(确保层级嵌套对齐) */
|
||||
.child-category-container {
|
||||
display: none;
|
||||
margin-left: 25px !important; /* 比拖拽图标缩进多5px,增强层级感,避免整体左偏 */
|
||||
}
|
||||
</style>
|
||||
<!-- 操作按钮区 -->
|
||||
<div class="single-filter-box" style="display: block">
|
||||
<button class="layui-btn" onclick="addCategory()">添加选型</button>
|
||||
</div>
|
||||
|
||||
<!-- 分类列表区:根容器+JSON数据注入 -->
|
||||
<div class="goods-category-list">
|
||||
<div class="table_div">
|
||||
<!-- 表头 -->
|
||||
<ul class="table_head">
|
||||
<li style="width:60px"></li>
|
||||
<li style="flex:6">分类名称</li>
|
||||
<li class="operate" style="flex:2">操作</li>
|
||||
</ul>
|
||||
<!-- 表体:空容器(JS递归渲染内容) -->
|
||||
<div class="table_body" id="category-container">
|
||||
{if condition="!$list"}
|
||||
<!-- 无数据时显示 -->
|
||||
<div class="category-item">
|
||||
<div class="table_td" style="flex:1;text-align: center;">暂无数据</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 关键:将PHP分类列表转为JS变量(模板引擎输出JSON) -->
|
||||
<script>
|
||||
// 从PHP获取分类数据,转为JS数组(支持任意层级)
|
||||
var categoryData = {$list|json_encode|raw};
|
||||
|
||||
// 编辑页URL生成函数(对应PHP的:href_url())
|
||||
function getEditUrl(cateId,pid) {
|
||||
return "{:url('shop/goodscategory/editcategory')}?category_id=" + cateId+'&pid='+pid;
|
||||
}
|
||||
function AddUrl(cateId) {
|
||||
location.hash = ns.hash("shop/seal/poststructure",{pid:cateId});
|
||||
}
|
||||
function EditUrl(cateId,pid) {
|
||||
location.hash = ns.hash("shop/seal/poststructure",{id:cateId,pid:pid});
|
||||
}
|
||||
</script>
|
||||
<script src="STATIC_EXT/drag-arrange.js"></script>
|
||||
<script src="STATIC_EXT/diyview/js/ddsort.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
// 1. 初始化:若有分类数据,调用JS递归渲染
|
||||
if (categoryData && categoryData.length > 0) {
|
||||
var $container = $('#category-container');
|
||||
// 清空无数据提示(若存在)
|
||||
$container.find('.category-item').remove();
|
||||
// 递归渲染根分类(depth=0)
|
||||
renderCategory(categoryData, 0, $container);
|
||||
}
|
||||
|
||||
// 2. 统一拖拽排序(按父分类分组)
|
||||
// initDragSort();
|
||||
|
||||
// 3. 展开/收起子分类
|
||||
bindSwitchEvent();
|
||||
|
||||
// 4. 图片放大(保持原有逻辑)
|
||||
// loadImgMagnify();
|
||||
});
|
||||
|
||||
/**
|
||||
* 前端递归渲染分类
|
||||
* @param {Array} cateList - 当前层级的分类数组
|
||||
* @param {Number} depth - 当前层级深度(根分类=0)
|
||||
* @param {jQuery} $parent - 父容器(子分类将插入此容器)
|
||||
*/
|
||||
function renderCategory(cateList, depth, $parent) {
|
||||
// 遍历当前层级的每个分类
|
||||
var num = 0
|
||||
cateList.forEach(function(cate,index) {
|
||||
// --------------------------
|
||||
// 新增:给child_list加默认值(空数组)
|
||||
cate.child_list = cate.child_list || [];
|
||||
// 1. 生成单个分类项的DOM
|
||||
// --------------------------
|
||||
var $cateItem = $('<div class="category-item"></div>')
|
||||
.data('cateid', cate.category_id)
|
||||
.data('parentid', cate.parent_id || 0)
|
||||
.data('sort', cate.sort)
|
||||
.data('depth', depth);
|
||||
|
||||
// 1.1 拖拽+展开/收起列
|
||||
var dragIconStyle = 'margin-left: ' + (depth * 0) + 'px;'; // 动态缩进
|
||||
console.log(cate.is_answer)
|
||||
if(cate.pid == 0){
|
||||
var switchHtml = cate.child_list.length > 0 // 直接判断长度即可
|
||||
? `<div class="switch text-color js-switch" data-cateid="${cate.category_id}" data-open="0">+</div>`
|
||||
: `<div class="switch text-color empty_switch"></div>`;
|
||||
}else{
|
||||
var switchHtml = (cate.child_list.length > 0) // 直接判断长度即可
|
||||
? `<div class="switch text-color js-switch" data-cateid="${cate.category_id}" data-open="0" style="position: absolute;left: 0;top: 14px;">+</div>`
|
||||
: `<div class="switch text-color empty_switch"></div>`;
|
||||
}
|
||||
|
||||
|
||||
var $col1 = $('<div class="table_td" style="width:60px;position: relative;"></div>')//drag-icon iconfont icontuodong
|
||||
.html(`<div class="" style="${dragIconStyle}"></div>` + switchHtml);
|
||||
|
||||
// 1.2 分类名称列(含英文名称)
|
||||
var nameHtml = cate.name;
|
||||
if(cate.is_answer == 1){
|
||||
nameHtml += '(这是结果)'
|
||||
var $col2 = $('<div class="table_td" style="flex:6;color:#ff0000"></div>').text(nameHtml);
|
||||
}else{
|
||||
var $col2 = $('<div class="table_td" style="flex:6;"></div>').text(nameHtml);
|
||||
}
|
||||
|
||||
// if (cate.en_category_name) nameHtml += `(${cate.en_category_name})`;
|
||||
|
||||
|
||||
// 1.5 操作列(编辑+删除)
|
||||
var ahtml = `<div class="table-btn">`
|
||||
if (cate.is_answer == 0) ahtml+= ` <a class="layui-btn" onclick="AddUrl(`+cate.category_id+`)">添加子类</a>`
|
||||
ahtml+= `<a class="layui-btn" onclick="EditUrl(`+cate.category_id+`,`+cate.pid+`)">编辑</a>
|
||||
<a class="layui-btn" href="javascript:deleteCategory(${cate.category_id});">删除</a>
|
||||
</div>`
|
||||
var $col5 = $('<div class="table_td" style="flex:2;"></div>')
|
||||
.html(ahtml);
|
||||
|
||||
// 组装单个分类项
|
||||
//, $col3 , $col4
|
||||
$cateItem.append($col1, $col2, $col5);
|
||||
|
||||
// --------------------------
|
||||
// 2. 生成子分类容器(若有子分类)
|
||||
// --------------------------
|
||||
var $childContainer = null;
|
||||
if (cate.child_list && cate.child_list.length > 0) {
|
||||
$childContainer = $('<div class="child-category-container" data-parent-cateid="' + cate.category_id + '"></div>');
|
||||
// 递归渲染子分类(深度+1,父容器为当前子分类容器)
|
||||
renderCategory(cate.child_list, depth + 1, $childContainer);
|
||||
}
|
||||
|
||||
// --------------------------
|
||||
// 3. 插入到父容器
|
||||
// --------------------------
|
||||
$parent.append($cateItem);
|
||||
if ($childContainer) $parent.append($childContainer);
|
||||
|
||||
// num = num + 1
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 绑定展开/收起事件
|
||||
*/
|
||||
function bindSwitchEvent() {
|
||||
$(".js-switch").off('click').on('click', function(e) {
|
||||
console.log(123)
|
||||
e.stopPropagation();
|
||||
var $switch = $(this);
|
||||
var cateId = $switch.data('cateid');
|
||||
var isOpen = $switch.data('open') === 1;
|
||||
console.log(cateId)
|
||||
// 切换按钮文本和子容器显示状态
|
||||
$switch.text(isOpen ? '+' : '-');
|
||||
$(`.child-category-container[data-parent-cateid="${cateId}"]`).toggle(!isOpen);
|
||||
$switch.data('open', isOpen ? 0 : 1);
|
||||
});
|
||||
}
|
||||
|
||||
// --------------------------
|
||||
// 原有功能函数(保持不变)
|
||||
// --------------------------
|
||||
function deleteCategory(category_id) {
|
||||
layer.confirm('确认删除吗?', function(index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("shop/seal/deleteStructure"),
|
||||
data: { category_id: category_id },
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code === 0) {
|
||||
listenerHash(); // 刷新页面
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function addCategory() {
|
||||
location.hash = ns.hash("shop/seal/poststructure",{pid:0});
|
||||
// location.hash = ns.hash("shop/goodscategory/addcategory");
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user