其余文件
This commit is contained in:
727
app/admin/view/select_link/index.html
Normal file
727
app/admin/view/select_link/index.html
Normal file
@ -0,0 +1,727 @@
|
||||
{layout name="layout2" /}
|
||||
<style>
|
||||
html,body {
|
||||
height: 100%;
|
||||
}
|
||||
.layui-nav {
|
||||
background-color: #ffffff !important;
|
||||
color: #000000 !important;
|
||||
}
|
||||
.layui-nav-itemed>a {
|
||||
color: #000000 !important;
|
||||
}
|
||||
.layui-nav-itemed>.layui-nav-child {
|
||||
background-color: #ffffff !important;
|
||||
}
|
||||
.layui-nav .layui-nav-mored, .layui-nav-itemed>a .layui-nav-more {
|
||||
border-color: transparent transparent #000!important;
|
||||
}
|
||||
.layui-nav .layui-nav-more {
|
||||
border-top-color: #000 !important;
|
||||
}
|
||||
.layui-nav .layui-nav-item a {
|
||||
color: #000 !important;
|
||||
}
|
||||
.layui-nav-tree .layui-nav-child a {
|
||||
color: #666 !important;
|
||||
}
|
||||
.layui-nav-tree .layui-nav-item a:hover {
|
||||
background-color: #ebf4ff !important;
|
||||
color: #3A91FB !important;
|
||||
}
|
||||
.layui-nav-tree .layui-this>a {
|
||||
background-color: #ebf4ff !important;
|
||||
color: #3A91FB !important;
|
||||
}
|
||||
.layui-nav-tree .layui-nav-bar {
|
||||
background-color: unset !important;
|
||||
}
|
||||
.select-base-this {
|
||||
border: 1px solid #3A91FB !important;
|
||||
color: #3A91FB !important;
|
||||
}
|
||||
.layui-nav-tree .layui-nav-child dd.layui-this, .layui-nav-tree .layui-nav-child dd.layui-this a, .layui-nav-tree .layui-this, .layui-nav-tree .layui-this>a, .layui-nav-tree .layui-this>a:hover {
|
||||
background-color: #ebf4ff !important;
|
||||
color: #3A91FB !important;
|
||||
}
|
||||
.layui-table-cell {
|
||||
height: auto !important;
|
||||
}
|
||||
</style>
|
||||
<div class="layui-fluid">
|
||||
|
||||
<div style="height: 98vh;display: flex;">
|
||||
<!-- 左侧 -->
|
||||
<div style="width: 200px;border: solid 1px #eee;border-radius: 8px;margin: 10px 20px 10px 0;overflow: hidden">
|
||||
<ul class="layui-nav layui-nav-tree" lay-filter="slectNav" lay-bar="disabled" style="margin-top: 20px">
|
||||
<li class="layui-nav-item layui-nav-itemed switch-nav">
|
||||
<a href="javascript:;" data-index="0">基础页面</a>
|
||||
</li>
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<a href="javascript:;">商品</a>
|
||||
<dl class="layui-nav-child">
|
||||
<dd class="switch-nav">
|
||||
<a href="javascript:;" data-index="1" style="padding-left: 40px;">普通商品</a>
|
||||
</dd>
|
||||
<dd class="switch-nav">
|
||||
<a href="javascript:;" data-index="2" style="padding-left: 40px;">平台分类</a>
|
||||
</dd>
|
||||
<dd class="switch-nav">
|
||||
<a href="javascript:;" data-index="3" style="padding-left: 40px;">商家列表</a>
|
||||
</dd>
|
||||
<dd class="switch-nav">
|
||||
<a href="javascript:;" data-index="4" style="padding-left: 40px;">活动专区</a>
|
||||
</dd>
|
||||
<dd class="switch-nav">
|
||||
<a href="javascript:;" data-index="5" style="padding-left: 40px;">秒杀商品</a>
|
||||
</dd>
|
||||
<dd class="switch-nav">
|
||||
<a href="javascript:;" data-index="6" style="padding-left: 40px;">拼团商品</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
<a href="javascript:;">其他</a>
|
||||
<dl class="layui-nav-child">
|
||||
<dd class="switch-nav">
|
||||
<a href="javascript:;" data-index="7" style="padding-left: 40px;">自定义链接</a>
|
||||
</dd>
|
||||
<dd class="switch-nav">
|
||||
<a href="javascript:;" data-index="8" style="padding-left: 40px;">微信小程序</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 右侧 -->
|
||||
<div class="layui-tab" lay-filter="selectTab" style="flex: 1;border: solid 1px #eee;border-radius: 8px;padding: 10px;overflow-y: auto;">
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item base-page layui-show"></div>
|
||||
<div class="layui-tab-item">
|
||||
<form class="layui-form layui-form-pane" action="" lay-filter="ordinary-goods-search">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="goods_name" placeholder="请输入商品名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="ordinary-goods-search-submit">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table id="ordinary-goods" lay-filter="ordinary-goods"></table>
|
||||
<script type="text/html" id="goods">
|
||||
<div style="display: flex;align-items: center">
|
||||
<img src="{{d.image}}" style="height:60px;width: 60px;margin-right: 5px;" class="image-show">
|
||||
<div style="margin-left: 10px">
|
||||
<p>{{d.name}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<table id="platform-goods-category" lay-filter="platform-goods-category"></table>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<table id="shop-lists" lay-filter="shop-lists"></table>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<table id="activity-area" lay-filter="activity-area"></table>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<form class="layui-form layui-form-pane" action="" lay-filter="seckill-goods-search">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="goods_name" placeholder="请输入商品名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="seckill-goods-search-submit">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table id="seckill-goods" lay-filter="seckill-goods"></table>
|
||||
<script type="text/html" id="seckill-goods-tmp">
|
||||
<div style="display: flex;align-items: center">
|
||||
<img src="{{d.image}}" style="height:60px;width: 60px;margin-right: 5px;" class="image-show">
|
||||
<div style="margin-left: 10px">
|
||||
<p>{{d.name}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<form class="layui-form layui-form-pane" action="" lay-filter="team-goods-search">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="goods_name" placeholder="请输入商品名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="team-goods-search-submit">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table id="team-goods" lay-filter="team-goods"></table>
|
||||
<script type="text/html" id="team-goods-tmp">
|
||||
<div style="display: flex;align-items: center">
|
||||
<img src="{{d.image}}" style="height:60px;width: 60px;margin-right: 5px;" class="image-show">
|
||||
<div style="margin-left: 10px">
|
||||
<p>{{d.name}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<h3>网页</h3>
|
||||
<div style="display: flex;margin-top: 30px">
|
||||
<p style="line-height: 38px;margin-left: 70px;">地址:</p>
|
||||
<div>
|
||||
<input type="text" name="custom_url" placeholder="请输入跳转链接" autocomplete="off" class="layui-input">
|
||||
<p style="color: #999;margin-top: 15px">1.请填写完整的带有 “http://” 或 “https://” 的链接网址</p>
|
||||
<p style="color: #999;margin-top: 10px">2.小程序中跳转,链接的域名必须在微信公众平台设置业务域名</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-tab-item layui-form">
|
||||
<h3>跳转小程序</h3>
|
||||
<div style="display: flex;margin-top: 30px">
|
||||
<p style="line-height: 38px;width: 120px;text-align: right">小程序原始ID:</p>
|
||||
<input type="text" name="mnp_original_id" placeholder="请输入小程序原始ID" autocomplete="off" class="layui-input" style="width: 400px">
|
||||
</div>
|
||||
<div style="display: flex;margin-top: 30px">
|
||||
<p style="line-height: 38px;width: 120px;text-align: right">小程序AppID:</p>
|
||||
<input type="text" name="mnp_app_id" placeholder="请输入小程序AppID" autocomplete="off" class="layui-input" style="width: 400px">
|
||||
</div>
|
||||
<div style="display: flex;margin-top: 30px">
|
||||
<p style="line-height: 38px;width: 120px;text-align: right">小程序路径:</p>
|
||||
<input type="text" name="mnp_path" placeholder="请输入小程序路径" autocomplete="off" class="layui-input" style="width: 400px">
|
||||
</div>
|
||||
<div style="display: flex;margin-top: 30px">
|
||||
<p style="line-height: 38px;width: 120px;text-align: right">传递参数:</p>
|
||||
<div>
|
||||
<input type="text" name="mnp_params" placeholder="请输入小程序跳转参数(选填)" autocomplete="off" class="layui-input" style="width: 400px">
|
||||
<p style="color: #999;margin-top: 15px">示例:id=2&ustm=jiny&name=234</p>
|
||||
<p style="color: red;margin-top: 10px">注意:不允许输入中文、特殊字符,如果出现“对不起,当前页面无法访问”,大概率是跳转参数的问题</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex;margin-top: 30px">
|
||||
<p style="line-height: 38px;width: 120px;text-align: right">小程序版本:</p>
|
||||
<div>
|
||||
<div>
|
||||
<input type="radio" name="mnp_version" lay-filter="mnp_version" value="release" title="正式版">
|
||||
<input type="radio" name="mnp_version" lay-filter="mnp_version" value="trial" title="体验版">
|
||||
<input type="radio" name="mnp_version" lay-filter="mnp_version" value="develop" title="开发版">
|
||||
</div>
|
||||
<p style="color: #999;margin-top: 15px">1.小程序路径链接地址请填写小程序的页面路径,如:pages/index/index</p>
|
||||
<p style="color: #999;margin-top: 10px">2.如果是H5(浏览器)中需要跳转到小程序,则需要以下配置:</p>
|
||||
<p style="color: #0075ff;margin-top: 2px">小程序管理后台->设置->隐私与安全->明文scheme拉起此小程序(点击跳转去配置)</p>
|
||||
<p style="color: #999;margin-top: 10px">3.App跳转小程序时,需要填写小程序的原始ID</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
//选中的值 link_type 链接类型:0-基础页面;1-普通商品;2-平台分类;3-商家列表;4-活动专区;5-秒杀商品;6-拼团商品;7-自定义链接;8-微信小程序;
|
||||
var select_value= {$select_value|raw};
|
||||
|
||||
layui.config({
|
||||
version:"{$front_version}",
|
||||
base: '/static/plug/' //静态资源所在路径
|
||||
}).extend({
|
||||
treeTable: 'treetable-lay/treeTable'
|
||||
,like: 'layui-admin/dist/layuiadmin/modules/like',
|
||||
}).use(['form','element','table', 'treeTable'], function() {
|
||||
let $ = layui.$;
|
||||
let form = layui.form;
|
||||
let layer = layui.layer;
|
||||
let element = layui.element;
|
||||
let table = layui.table;
|
||||
|
||||
|
||||
//点击导航切换选项卡
|
||||
tabLoad(select_value.link_type);
|
||||
$('.switch-nav').removeClass('layui-this');
|
||||
$('.switch-nav').eq(select_value.link_type).addClass('layui-this');
|
||||
$('.layui-tab-item').removeClass('layui-show');
|
||||
$('.layui-tab-item').eq(select_value.link_type).addClass('layui-show');
|
||||
element.on('nav(slectNav)', function(elem){
|
||||
var index = elem[0].dataset.index; // 获取当前导航项的索引
|
||||
if (index !== undefined) {
|
||||
$('.layui-tab-item').removeClass('layui-show');
|
||||
$('.layui-tab-item').eq(index).addClass('layui-show');
|
||||
|
||||
tabLoad(index);
|
||||
}
|
||||
});
|
||||
//处理不同选项卡加载不同内容
|
||||
function tabLoad(index) {
|
||||
index = index.toString()
|
||||
switch (index) {
|
||||
case '0':
|
||||
getBasePage()
|
||||
break;
|
||||
case '1':
|
||||
getOrdinaryGoodsList()
|
||||
break;
|
||||
case '2':
|
||||
getPlatformGoodsCategoryList()
|
||||
break;
|
||||
case '3':
|
||||
getShopList()
|
||||
break;
|
||||
case '4':
|
||||
getActivityArea()
|
||||
break;
|
||||
case '5':
|
||||
getSeckillGoods()
|
||||
break;
|
||||
case '6':
|
||||
getTeamGoods()
|
||||
break;
|
||||
case '7':
|
||||
$('input[name="custom_url"]').val(select_value.link_type == 7 ? select_value.link_address : '')
|
||||
break;
|
||||
case '8':
|
||||
$('input[name="mnp_original_id"]').val(select_value.link_type == 8 ? select_value.mnp_original_id : '')
|
||||
$('input[name="mnp_app_id"]').val(select_value.link_type == 8 ? select_value.mnp_app_id : '')
|
||||
$('input[name="mnp_path"]').val(select_value.link_type == 8 ? select_value.mnp_path : '')
|
||||
$('input[name="mnp_params"]').val(select_value.link_type == 8 ? select_value.mnp_params : '')
|
||||
if (select_value.link_type == 8 && select_value.mnp_version.length) {
|
||||
$("input[name=mnp_version][value="+select_value.mnp_version+"]").prop("checked",true)
|
||||
} else {
|
||||
$("input[name=mnp_version][value='release']").prop("checked",true)
|
||||
select_value.mnp_version = 'release'
|
||||
}
|
||||
form.render('radio');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//获取基础页面
|
||||
function getBasePage() {
|
||||
$.ajax({
|
||||
url: "{:url('select_link/getBasePage')}",
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.code === 1) {
|
||||
var base_page_html = '';
|
||||
for (var i in res.data) {
|
||||
base_page_html += '<div style="margin-bottom: 30px">';
|
||||
base_page_html += '<h3>'+i+'</h3>';
|
||||
base_page_html += '<div style="margin-top: 10px;display: flex;flex-wrap: wrap;">';
|
||||
|
||||
for (var j in res.data[i]) {
|
||||
if (select_value.link_type == 0 && select_value.link_address == res.data[i][j].link) {
|
||||
base_page_html += '<button type="button" class="layui-btn layui-btn-primary select-base-link select-base-this" data-link="'+res.data[i][j].link+'" style="margin: 15px 15px 0 0;width: 94px">'+res.data[i][j].name+'</button>';
|
||||
} else {
|
||||
base_page_html += '<button type="button" class="layui-btn layui-btn-primary select-base-link" data-link="'+res.data[i][j].link+'" style="margin: 15px 15px 0 0;width: 94px">'+res.data[i][j].name+'</button>';
|
||||
}
|
||||
}
|
||||
|
||||
base_page_html += '</div>';
|
||||
base_page_html += '</div>';
|
||||
}
|
||||
|
||||
$('.base-page').html(base_page_html);
|
||||
} else {
|
||||
layer.msg(res.msg, {icon: 2, time: 1000});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//点击基础页面选择链接
|
||||
$(document).on('click','.select-base-link',function(elem){
|
||||
$('.select-base-link').removeClass('select-base-this');
|
||||
$(this).addClass('select-base-this');
|
||||
select_value.link_type = 0;
|
||||
select_value.link_address = elem.target.dataset.link;
|
||||
})
|
||||
|
||||
|
||||
//获取普通商品
|
||||
function getOrdinaryGoodsList() {
|
||||
table.render({
|
||||
elem: '#ordinary-goods'
|
||||
, url: "{:url('select_link/getOrdinaryGoods')}"
|
||||
, cols: [
|
||||
[
|
||||
{ type:'radio', field:'id'}
|
||||
,{ field: 'goods', title: '商品信息', minwidth:300, templet: '#goods'}
|
||||
,{ field: 'price', title: '价格', minwidth:100}
|
||||
,{ field: 'stock', title: '库存', minwidth:100}
|
||||
]
|
||||
]
|
||||
, where: form.val("ordinary-goods-search")
|
||||
, text: {none: '暂无相关数据'}
|
||||
, response: {
|
||||
statusCode: 1
|
||||
}
|
||||
, page: true
|
||||
, parseData: function (res) {
|
||||
for (let i=0; i<res.data.lists.length; i++){
|
||||
if (select_value.link_type == 1) {
|
||||
const match = select_value.link_address.match(/id=([^&]*)/);
|
||||
const id = match ? match[1] : null;
|
||||
if (id == res.data.lists[i].id) {
|
||||
// 设置初始选中
|
||||
res.data.lists[i].LAY_CHECKED = 'checked';
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
"code": res.code,
|
||||
"msg": res.msg,
|
||||
"count": res.data.count,
|
||||
"data": res.data.lists
|
||||
};
|
||||
}
|
||||
, done: function () {
|
||||
// 解决操作栏因为内容过多换行问题
|
||||
$(".layui-table-main tr").each(function (index, val) {
|
||||
$($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 搜索商品
|
||||
form.on('submit(ordinary-goods-search-submit)', function(data) {
|
||||
getOrdinaryGoodsList();
|
||||
return false;
|
||||
});
|
||||
//点击普通商品选择链接
|
||||
table.on('radio(ordinary-goods)', function(obj){
|
||||
select_value.link_type = 1;
|
||||
select_value.link_address = '/pages/goods_details/goods_details?id='+obj.data.id;
|
||||
});
|
||||
|
||||
|
||||
//获取平台商品分类
|
||||
function getPlatformGoodsCategoryList() {
|
||||
table.render({
|
||||
elem: '#platform-goods-category'
|
||||
, url: "{:url('select_link/getPlatformGoodsCategory')}"
|
||||
, cols: [
|
||||
[
|
||||
{ type:'radio', field:'id'}
|
||||
,{ field: 'name', title: '分类名称'}
|
||||
]
|
||||
]
|
||||
, text: {none: '暂无相关数据'}
|
||||
, response: {
|
||||
statusCode: 1
|
||||
}
|
||||
, page: true
|
||||
, parseData: function (res) {
|
||||
for (let i=0; i<res.data.lists.length; i++){
|
||||
if (select_value.link_type == 2 && select_value.category_id == res.data.lists[i].id) {
|
||||
// 设置初始选中
|
||||
res.data.lists[i].LAY_CHECKED = 'checked';
|
||||
}
|
||||
}
|
||||
return {
|
||||
"code": res.code,
|
||||
"msg": res.msg,
|
||||
"count": res.data.count,
|
||||
"data": res.data.lists
|
||||
};
|
||||
}
|
||||
, done: function () {
|
||||
// 解决操作栏因为内容过多换行问题
|
||||
$(".layui-table-main tr").each(function (index, val) {
|
||||
$($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//点击平台商品分类选择链接
|
||||
table.on('radio(platform-goods-category)', function(obj){
|
||||
select_value.link_type = 2;
|
||||
select_value.link_address = '/pages/goods_cate/goods_cate';
|
||||
select_value.category_id = obj.data.id
|
||||
});
|
||||
|
||||
|
||||
//获取商家列表
|
||||
function getShopList() {
|
||||
table.render({
|
||||
elem: '#shop-lists'
|
||||
, url: "{:url('select_link/getShopList')}"
|
||||
, cols: [
|
||||
[
|
||||
{ type:'radio', field:'id'}
|
||||
,{ field: 'name', title: '商家名称'}
|
||||
]
|
||||
]
|
||||
, text: {none: '暂无相关数据'}
|
||||
, response: {
|
||||
statusCode: 1
|
||||
}
|
||||
, page: true
|
||||
, parseData: function (res) {
|
||||
for (let i=0; i<res.data.lists.length; i++){
|
||||
if (select_value.link_type == 3) {
|
||||
const match = select_value.link_address.match(/id=([^&]*)/);
|
||||
const id = match ? match[1] : null;
|
||||
if (id == res.data.lists[i].id) {
|
||||
// 设置初始选中
|
||||
res.data.lists[i].LAY_CHECKED = 'checked';
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
"code": res.code,
|
||||
"msg": res.msg,
|
||||
"count": res.data.count,
|
||||
"data": res.data.lists
|
||||
};
|
||||
}
|
||||
, done: function () {
|
||||
// 解决操作栏因为内容过多换行问题
|
||||
$(".layui-table-main tr").each(function (index, val) {
|
||||
$($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//点击商家列表选择链接
|
||||
table.on('radio(shop-lists)', function(obj){
|
||||
select_value.link_type = 3;
|
||||
select_value.link_address = '/pages/store_index/store_index?id='+obj.data.id;
|
||||
});
|
||||
|
||||
|
||||
//获取活动专区
|
||||
function getActivityArea() {
|
||||
table.render({
|
||||
elem: '#activity-area'
|
||||
, url: "{:url('select_link/getActivityArea')}"
|
||||
, cols: [
|
||||
[
|
||||
{ type:'radio', field:'id'}
|
||||
,{ field: 'name', title: '活动名称'}
|
||||
]
|
||||
]
|
||||
, text: {none: '暂无相关数据'}
|
||||
, response: {
|
||||
statusCode: 1
|
||||
}
|
||||
, page: true
|
||||
, parseData: function (res) {
|
||||
for (let i=0; i<res.data.lists.length; i++){
|
||||
if (select_value.link_type == 4) {
|
||||
const match = select_value.link_address.match(/id=([^&]*)/);
|
||||
const id = match ? match[1] : null;
|
||||
if (id == res.data.lists[i].id) {
|
||||
// 设置初始选中
|
||||
res.data.lists[i].LAY_CHECKED = 'checked';
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
"code": res.code,
|
||||
"msg": res.msg,
|
||||
"count": res.data.count,
|
||||
"data": res.data.lists
|
||||
};
|
||||
}
|
||||
, done: function () {
|
||||
// 解决操作栏因为内容过多换行问题
|
||||
$(".layui-table-main tr").each(function (index, val) {
|
||||
$($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//点击商家列表选择链接
|
||||
table.on('radio(activity-area)', function(obj){
|
||||
select_value.link_type = 4;
|
||||
select_value.link_address = '/bundle/pages/activity_detail/activity_detail?id='+obj.data.id;
|
||||
});
|
||||
|
||||
|
||||
//获取秒杀商品
|
||||
function getSeckillGoods() {
|
||||
table.render({
|
||||
elem: '#seckill-goods'
|
||||
, url: "{:url('select_link/getSeckillGoods')}"
|
||||
, cols: [
|
||||
[
|
||||
{ type:'radio', field:'id'}
|
||||
,{ field: 'goods', title: '商品信息', minwidth:300, templet: '#seckill-goods-tmp'}
|
||||
,{ field: 'seckill_price', title: '价格', minwidth:100}
|
||||
]
|
||||
]
|
||||
, where: form.val("seckill-goods-search")
|
||||
, text: {none: '暂无相关数据'}
|
||||
, response: {
|
||||
statusCode: 1
|
||||
}
|
||||
, page: true
|
||||
, parseData: function (res) {
|
||||
for (let i=0; i<res.data.lists.length; i++){
|
||||
if (select_value.link_type == 5) {
|
||||
const match = select_value.link_address.match(/id=([^&]*)/);
|
||||
const id = match ? match[1] : null;
|
||||
if (id == res.data.lists[i].id) {
|
||||
// 设置初始选中
|
||||
res.data.lists[i].LAY_CHECKED = 'checked';
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
"code": res.code,
|
||||
"msg": res.msg,
|
||||
"count": res.data.count,
|
||||
"data": res.data.lists
|
||||
};
|
||||
}
|
||||
, done: function () {
|
||||
// 解决操作栏因为内容过多换行问题
|
||||
$(".layui-table-main tr").each(function (index, val) {
|
||||
$($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 搜索商品
|
||||
form.on('submit(seckill-goods-search-submit)', function(data) {
|
||||
getSeckillGoods();
|
||||
return false;
|
||||
});
|
||||
//点击普通商品选择链接
|
||||
table.on('radio(seckill-goods)', function(obj){
|
||||
select_value.link_type = 5;
|
||||
select_value.link_address = '/pages/goods_details/goods_details?id='+obj.data.id;
|
||||
});
|
||||
|
||||
|
||||
//获取拼团商品
|
||||
function getTeamGoods() {
|
||||
table.render({
|
||||
elem: '#team-goods'
|
||||
, url: "{:url('select_link/getTeamGoods')}"
|
||||
, cols: [
|
||||
[
|
||||
{ type:'radio', field:'id'}
|
||||
,{ field: 'goods', title: '商品信息', minwidth:300, templet: '#team-goods-tmp'}
|
||||
,{ field: 'team_price', title: '价格', minwidth:100}
|
||||
]
|
||||
]
|
||||
, where: form.val("team-goods-search")
|
||||
, text: {none: '暂无相关数据'}
|
||||
, response: {
|
||||
statusCode: 1
|
||||
}
|
||||
, page: true
|
||||
, parseData: function (res) {
|
||||
for (let i=0; i<res.data.lists.length; i++){
|
||||
if (select_value.link_type == 6) {
|
||||
const match = select_value.link_address.match(/id=([^&]*)/);
|
||||
const id = match ? match[1] : null;
|
||||
if (id == res.data.lists[i].id) {
|
||||
// 设置初始选中
|
||||
res.data.lists[i].LAY_CHECKED = 'checked';
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
"code": res.code,
|
||||
"msg": res.msg,
|
||||
"count": res.data.count,
|
||||
"data": res.data.lists
|
||||
};
|
||||
}
|
||||
, done: function () {
|
||||
// 解决操作栏因为内容过多换行问题
|
||||
$(".layui-table-main tr").each(function (index, val) {
|
||||
$($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 搜索商品
|
||||
form.on('submit(team-goods-search-submit)', function(data) {
|
||||
getTeamGoods();
|
||||
return false;
|
||||
});
|
||||
//点击普通商品选择链接
|
||||
table.on('radio(team-goods)', function(obj){
|
||||
select_value.link_type = 6;
|
||||
select_value.link_address = '/pages/goods_details/goods_details?id='+obj.data.id;
|
||||
});
|
||||
|
||||
|
||||
//监听自定义链接输入事件
|
||||
$('input[name="custom_url"]').on('input', function() {
|
||||
const value = $(this).val(); // 获取输入框的值
|
||||
select_value.link_type = 7;
|
||||
select_value.link_address = value;
|
||||
});
|
||||
|
||||
|
||||
//监听微信小程序输入事件
|
||||
$('input[name="mnp_original_id"]').on('input', function() {
|
||||
const value = $(this).val(); // 获取输入框的值
|
||||
select_value.link_type = 8;
|
||||
select_value.link_address = 'https://mp.weixin.qq.com';
|
||||
select_value.mnp_original_id = value;
|
||||
});
|
||||
$('input[name="mnp_app_id"]').on('input', function() {
|
||||
const value = $(this).val(); // 获取输入框的值
|
||||
select_value.link_type = 8;
|
||||
select_value.link_address = 'https://mp.weixin.qq.com';
|
||||
select_value.mnp_app_id = value;
|
||||
});
|
||||
$('input[name="mnp_path"]').on('input', function() {
|
||||
const value = $(this).val(); // 获取输入框的值
|
||||
select_value.link_type = 8;
|
||||
select_value.link_address = 'https://mp.weixin.qq.com';
|
||||
select_value.mnp_path = value;
|
||||
});
|
||||
$('input[name="mnp_params"]').on('input', function() {
|
||||
const value = $(this).val(); // 获取输入框的值
|
||||
select_value.link_type = 8;
|
||||
select_value.link_address = 'https://mp.weixin.qq.com';
|
||||
select_value.mnp_params = value;
|
||||
});
|
||||
form.on('radio(mnp_version)', function(data){
|
||||
const value = data.value;
|
||||
select_value.link_type = 8;
|
||||
select_value.link_address = 'https://mp.weixin.qq.com';
|
||||
select_value.mnp_version = value;
|
||||
});
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user