记得上下班打卡 | git大法好,push需谨慎

Commit 8a1e132a authored by sangchunxi's avatar sangchunxi

推荐活动edit 3

parent ddf04be7
...@@ -224,10 +224,15 @@ ...@@ -224,10 +224,15 @@
</div> </div>
</div> </div>
<div class="basis_data"> <div class="basis_data">
<a class="btn btn-primary btn-xs" href="javascript:void(0)">添加dom</a> <span>
<em class="required"></em>
</span>
<a class="btn btn-default btn-xs" href="javascript:void(0)" onclick="addDom()">添加推荐</a>
</div> </div>
<!-- --> <!-- -->
...@@ -253,7 +258,9 @@ ...@@ -253,7 +258,9 @@
let itemId = Number(getUrlParms('id')) let itemId = Number(getUrlParms('id'))
let affiliatedUrl = ['', 'goblin/common/sku', 'goblin/common/mix', 'kylin/performances/roadShow/performance/status', 'compilations/goodsList'] let affiliatedUrl = ['', 'goblin/common/sku', 'goblin/common/mix', 'kylin/performances/roadShow/performance/status', 'compilations/goodsList']
let isOneDom = $('#addClassify2').find($('.addAvatarItem')).length === 1 // 判断是否默认一组表单 let isOneDom = $('#addClassify2').find($('.addAvatarItem')).length // 判断是否默认一组表单
console.log('isOneDom', isOneDom)
// init // init
$(function() { $(function() {
...@@ -272,6 +279,46 @@ ...@@ -272,6 +279,46 @@
}); });
}); });
// 监听 模糊搜索
let search = new searchSelect('#search', [], function(val) {
let _params = {}
if (activeTypeChangeVal === 1) {
_params['type'] = 1
_params['title'] = val
} else if (activeTypeChangeVal === 2) { // 组合购
_params['title'] = val
} else if (activeTypeChangeVal === 3) { // 演出
_params['status'] = '(3,6,7,9,10)'
_params['title'] = val
} else { // 商品
_params['name'] = 1
_params['title'] = val
}
$.ajax({
type: 'get',
url: ctx + currentUrl,
contentType: "application/json;charset=UTF-8",
data: _params,
success: function(res) {
let forData = activeTypeChangeVal === 3 ? res.value : res.data
let _data = forData.map(item => {
if (activeTypeChangeVal === 1) { // NFT
return { id: item.spuId, value: item.spuName }
} else if (activeTypeChangeVal === 2) {
return { id: item.mixId, value: item.name }
} else if (activeTypeChangeVal === 3) {
return { id: item.performancesId, value: item.title }
} else if (activeTypeChangeVal === 4) { // 商品
return { id: item.spuId, value: item.name }
}
})
search.update(_data)
}
})
})
search.search(true)
}) // init end }) // init end
getPageData() // 最开始加载 getPageData() // 最开始加载
...@@ -289,18 +336,32 @@ ...@@ -289,18 +336,32 @@
list = res.list list = res.list
$('#activeName').attr('value', res.name)
$('#activeType').find(`option[value=${res.activeType}]`).attr('selected', true)
$('#search input').attr('value', res.activeBindId)
$('#status').find(`option[value=${res.status}]`).attr('selected', true)
$('#startTime').attr('value', res.startTime)
$('#endTime').attr('value', res.endTime)
assembleDom(list) assembleDom(list)
// 创建监听
setTimeout(() => { setTimeout(() => {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
createListenerSearch(i + 1) createListenerSearch(i + 1)
} }
}, 500) }, 500)
// 回显 search
setTimeout(() => { setTimeout(() => {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
$('#listRemoteSearch' + (i + 1)).update([{ id: list[i].recommendActiveId, value: list[i].name }]) $('#listRemoteSearch' + (i + 1) + ' input').attr('value', list[i].recommendActiveId)
$('#listRemoteSearch' + (i + 1)).assignment(1) $('#listActiveType' + (i + 1)).find(`option[value=${list[i].type}]`).attr('selected', true)
} }
}, 800) }, 800)
...@@ -323,7 +384,7 @@ ...@@ -323,7 +384,7 @@
<span class="span-label"><i style="color: red;">*</i>推荐商品:</span> <span class="span-label"><i style="color: red;">*</i>推荐商品:</span>
<div class="search-wrapper"> <div class="search-wrapper">
<div class="search-wrapper" style="margin-bottom: 15px;"> <div class="search-wrapper" style="margin-bottom: 15px;">
<div id="listRemoteSearch${index + 1}" placeholder="请搜索" name="seaarchSelect${index + 1}"></div> <div id="listRemoteSearch${index + 1}" placeholder="请搜索" name="seaarchSelect${index + 1}" class="weqewewe"></div>
</div> </div>
</div> </div>
</div> </div>
...@@ -351,13 +412,13 @@ ...@@ -351,13 +412,13 @@
<span class="span-label"><i style="color: red;">*</i>推荐商品:</span> <span class="span-label"><i style="color: red;">*</i>推荐商品:</span>
<div class="search-wrapper"> <div class="search-wrapper">
<div class="search-wrapper" style="margin-bottom: 15px;"> <div class="search-wrapper" style="margin-bottom: 15px;">
<div id="listRemoteSearch${index}" placeholder="请搜索" name="seaarchSelect${index}"></div> <div id="listRemoteSearch${isOneDom + 1}" placeholder="请搜索" name="seaarchSelect${isOneDom + 1}"></div>
</div> </div>
</div> </div>
</div> </div>
<div class="selectClassifyOne"> <div class="selectClassifyOne">
<span class="span-label"><i style="color: red;">*</i>推荐类型:</span> <span class="span-label"><i style="color: red;">*</i>推荐类型:</span>
<select id="listActiveType${index}" class="form-control m-b" style="width: 170px;"> <select id="listActiveType${isOneDom + 1}" class="form-control m-b" style="width: 170px;">
<option value="">所有</option> <option value="">所有</option>
<option value="1">NFT</option> <option value="1">NFT</option>
<option value="2">组合购</option> <option value="2">组合购</option>
...@@ -368,8 +429,18 @@ ...@@ -368,8 +429,18 @@
// 只有一组,可添加 // 只有一组,可添加
if (isOneDom) { if (1) {
console.log('只有一组,可添加', isOneDom)
$('#addClassify2').append(dynamicAddDom) $('#addClassify2').append(dynamicAddDom)
setTimeout(() => {
// 监听 模糊搜索
new searchSelect(`#listRemoteSearch${isOneDom + 1}`, [], function(val) {
searchAjax(val, isOneDom + 1)
})
}, 500)
} else { } else {
layer.msg('不能添加') layer.msg('不能添加')
} }
......
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
body .layui-layer-btn { body .layui-layer-btn {
display: none !important; display: none !important;
} }
.datetimepicker {
z-index: 99999999 !important;
}
/*.layui-layer {*/
/* z-index: 900 !important;*/
/*}*/
#layui-layer1 { #layui-layer1 {
z-index: 1001 !important; z-index: 1001 !important;
} }
...@@ -407,7 +413,7 @@ ...@@ -407,7 +413,7 @@
return { id: item.mixId, value: item.name } return { id: item.mixId, value: item.name }
} else if (activeTypeChangeVal === 3) { } else if (activeTypeChangeVal === 3) {
return { id: item.performancesId, value: item.title } return { id: item.performancesId, value: item.title }
} else { // 商品 } else if (activeTypeChangeVal === 4) { // 商品
return { id: item.spuId, value: item.name } return { id: item.spuId, value: item.name }
} }
}) })
...@@ -449,7 +455,7 @@ ...@@ -449,7 +455,7 @@
return { id: item.mixId, value: item.name } return { id: item.mixId, value: item.name }
} else if (activeTypeChangeValChild === 3) { } else if (activeTypeChangeValChild === 3) {
return { id: item.performancesId, value: item.title } return { id: item.performancesId, value: item.title }
} else { // 商品 } else if (activeTypeChangeValChild === 4) { // 商品
return { id: item.spuId, value: item.name } return { id: item.spuId, value: item.name }
} }
}) })
...@@ -519,7 +525,7 @@ ...@@ -519,7 +525,7 @@
title: '增加活动', // 不显示标题 title: '增加活动', // 不显示标题
content: $('#addClassify'), // 捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响 content: $('#addClassify'), // 捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
cancel: function(res){ cancel: function(res){
$("#addClassify").empty() // $("#addClassify").empty()
// layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', {time: 5000, icon:6}); // layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', {time: 5000, icon:6});
} }
}); });
...@@ -533,8 +539,8 @@ ...@@ -533,8 +539,8 @@
shade: .3, shade: .3,
title: '增加关联推荐', // 不显示标题 title: '增加关联推荐', // 不显示标题
content: $('#addClassify2'), // 捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响 content: $('#addClassify2'), // 捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
cancel: function(res){ cancel: function(res) {
$("#addClassify2").empty() // $("#addClassify2").empty()
// layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', {time: 5000, icon:6}); // layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', {time: 5000, icon:6});
} }
}); });
...@@ -556,13 +562,11 @@ ...@@ -556,13 +562,11 @@
// 关闭模态框 // 关闭模态框
function closeModal () { function closeModal () {
$("#addClassify").empty() layer.close(layer.index)
$(".layui-layer-close1").click();
} }
// 关闭模态框2 // 关闭模态框2
function closeModal2 () { function closeModal2 () {
$("#addClassify2").empty()
layer.close(layer.index) layer.close(layer.index)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment