Authored by chenjian

Merge branch 'dev_available_channel' into test6.8.4

... ... @@ -288,41 +288,50 @@
<div class="panel-body">
<div class="row">
[[each couponAvailableChannels as Available_Channels i]]
<div class="form-group">
<div class="col-sm-8">
<label class="col-sm-2 control-label">可用渠道 [[i]]</label>
<!-- 渠道 -->
<div class="col-sm-2">
<label class="checkbox-inline">
<!-- 判断是否选中 -->
<input type="checkbox" class="couponAvailableChannels" disabled
[[each channel as Available_Channels_status j]]
[[if Available_Channels_status.groupId==Available_Channels.groupId]]
checked
[[/if]]
[[/each]]
value="[[Available_Channels.groupId]]"> [[Available_Channels.groupName]]
</label>
<div>
<div>
<div class="form-group">
<div class="col-sm-12">
<!--<label class="col-sm-2 control-label"></label>-->
<!-- 渠道 -->
<div class="col-sm-8">
<label class="checkbox-inline">
<!-- 判断是否选中 -->
<input type="checkbox" class="couponAvailableChannels" disabled
[[each channel as Available_Channels_status j]]
[[if Available_Channels_status.groupId==Available_Channels.groupId]]
checked
[[/if]]
[[/each]]
value="[[Available_Channels.groupId]]"> [[Available_Channels.groupName]]
</label>
</div>
</div>
</div>
</div>
<div>
<!-- 子门店 -->
[[if Available_Channels.storeList]]
<div class="col-sm-8">
[[each Available_Channels.storeList as Available_storeList index]]
<label class="checkbox-inline">
<!-- 判断是否选中 -->
<input type="checkbox" class="couponAvailableChannelStoreList couponAvailableChannelStoreList_[[Available_Channels.groupId]]" disabled
[[each channel as Available_Channels_status j]]
[[if Available_Channels_status.groupId==Available_Channels.groupId]]
[[each Available_Channels_status.storeList as Available_Channels_storeList_status k]]
[[if Available_Channels_storeList_status==Available_storeList.storeId]]
checked
[[/if]]
[[/each]]
[[/if]]
<div class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-8">
[[each Available_Channels.storeList as Available_storeList index]]
<label class="checkbox-inline">
<!-- 判断是否选中 -->
<input type="checkbox" class="couponAvailableChannelStoreList couponAvailableChannelStoreList_[[Available_Channels.groupId]]" disabled
[[each channel as Available_Channels_status j]]
[[if Available_Channels_status.groupId==Available_Channels.groupId]]
[[each Available_Channels_status.storeList as Available_Channels_storeList_status k]]
[[if Available_Channels_storeList_status==Available_storeList.storeId]]
checked
[[/if]]
[[/each]]
[[/if]]
[[/each]]
value="[[Available_storeList.storeId]]"> [[Available_storeList.storeName]] [[Available_Channels_storeList_status]]
</label>
[[/each]]
value="[[Available_storeList.storeId]]"> [[Available_storeList.storeName]] [[Available_Channels_storeList_status]]
</label>
[[/each]]
</div>
</div>
[[/if]]
</div>
... ...
... ... @@ -400,6 +400,30 @@ $(document).on("keyup", ".number", function () {
});
function channelChangeListen() {
/**
* 输入值的变化时,获得渠道限制的勾选信息并寄存下来,从而在重新渲染页面时能回显用户已勾选的选项
* @type {any}
*/
var jsonDataChannel = []
$('input:checkbox[class="couponAvailableChannels"]:checked').each(function () {
for (var i = 0; i < couponBean.couponAvailableChannels.length; i++) {
if (couponBean.couponAvailableChannels[i].groupId == $(this).val()) {
var channelObject = {}
channelObject.storeList = []
channelObject.groupId = $(this).val()
var className = "couponAvailableChannelStoreList_" + $(this).val()
$("." + className).each(function () {
if ($(this).is(':checked'))
channelObject.storeList.push($(this).val())
})
jsonDataChannel.push(channelObject)
}
}
});
couponBean.channel = jsonDataChannel
}
/**
* 渠道限制事件
*/
... ... @@ -412,6 +436,9 @@ $(document).on("click", 'input:checkbox[class="couponAvailableChannels"]', funct
// console.log($(this).val())
$(this).prop("checked", mark)
})
// 临时保存一下勾选值
channelChangeListen()
});
/**
... ... @@ -442,6 +469,9 @@ $(document).on("click", '.couponAvailableChannelStoreList', function () {
$(localN).find('.couponAvailableChannels').prop("checked", false)
}
}
// 临时保存一下勾选值
channelChangeListen()
});
... ... @@ -459,6 +489,9 @@ $(document).on("click", "#couponAvailableChannelsSelectAll", function () {
$(data[i]).prop("checked", false)
}
}
// 临时保存一下勾选值
channelChangeListen()
});
... ...