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

Commit 8cebb2bd authored by sangchunxi's avatar sangchunxi

推荐活动edit 1

parent 462c2896
...@@ -251,6 +251,7 @@ ...@@ -251,6 +251,7 @@
let prefix2 = ctx + "local"; let prefix2 = ctx + "local";
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 isOneDom = $('#addClassify2').find($('.addAvatarItem')).length === 1 // 判断是否默认一组表单 let isOneDom = $('#addClassify2').find($('.addAvatarItem')).length === 1 // 判断是否默认一组表单
...@@ -294,7 +295,7 @@ ...@@ -294,7 +295,7 @@
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
createListenerSearch(i + 1) createListenerSearch(i + 1)
} }
}) }, 500)
...@@ -315,13 +316,13 @@ ...@@ -315,13 +316,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}">11</div> <div id="listRemoteSearch${index + 1}" placeholder="请搜索" name="seaarchSelect${index + 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}" value="${item.type}" class="form-control m-b" style="width: 170px;"> <select id="listActiveType${index + 1}" value="${item.type}" 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>
...@@ -374,7 +375,49 @@ ...@@ -374,7 +375,49 @@
function createListenerSearch (index) { function createListenerSearch (index) {
console.log('createListenerSearch', index) console.log('createListenerSearch', index)
// 监听 模糊搜索 // 监听 模糊搜索
new searchSelect(`listRemoteSearch${index}`, [], function(val) {}) new searchSelect(`#listRemoteSearch${index}`, [], function(val) {
searchAjax(val, index)
})
}
function searchAjax (val, index) {
let _selectVal = $("#listActiveType" + index).find("option:selected").val() // 当前子select
console.log('ajax', _selectVal)
let _params = {}
if (_selectVal === 1) {
_params['type'] = 1
_params['title'] = val
} else if (_selectVal === 2) { // 组合购
_params['title'] = val
} else if (_selectVal === 3) { // 演出
_params['status'] = '(3,6,7,9,10)'
_params['title'] = val
} else { // 商品
_params['name'] = 1
_params['title'] = val
}
$.ajax({
type: 'get',
url: ctx + affiliatedUrl[_selectVal - 1],
contentType: "application/json;charset=UTF-8",
data: _params,
success: function(res) {
let forData = _selectVal === 3 ? res.value : res.data
let _data = forData.map(item => {
if (_selectVal === 1) { // NFT
return { id: item.spuId, value: item.spuName }
} else if (_selectVal === 2) {
return { id: item.mixId, value: item.name }
} else if (_selectVal === 3) {
return { id: item.performancesId, value: item.title }
} else { // 商品
return { id: item.spuId, value: item.name }
}
})
search.update(_data)
}
})
} }
// 保存/更新 // 保存/更新
......
...@@ -451,7 +451,7 @@ ...@@ -451,7 +451,7 @@
return { id: item.spuId, value: item.name } return { id: item.spuId, value: item.name }
} }
}) })
search.update(_data) listRemoteSearch1.update(_data)
} }
}) })
......
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