caipan_shop_admin/view/manager/push/add.html

148 lines
6.7 KiB
HTML
Executable File
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{layout name="manager/layout"}
<div class="layuimini-container location-operate-page location-add-page">
<div class="layuimini-main">
<div class="layui-form layuimini-form">
<div class="layui-form-item">
<label class="layui-form-label">消息标题</label>
<div class="layui-input-block">
<input type="text" name="item[title]" placeholder="请输入消息标题" class="layui-input" maxlength="100">
</div>
</div>
<input type="hidden" name="item[type]" value="notice">
<div class="layui-form-item">
<label class="layui-form-label required">目标人群</label>
<div class="layui-input-block">
<select name="item[target]" lay-filter="target">
{foreach $targetList as $ki => $kv}
<option value="{$ki}">{$kv}</option>
{/foreach}
</select>
</div>
</div>
<div class="layui-form-item target-list layui-hide">
<label class="layui-form-label required">接收用户</label>
<div class="layui-input-block">
<div id="receive-users"></div>
</div>
</div>
<div class="layui-form-item subscribe-select">
<label class="layui-form-label">订阅模版</label>
<div class="layui-input-block">
<select class="layui-select" name="item[subscribe_temp_id]" lay-filter="subscribeChange">
<option value="">请选择订阅消息模版 不选择则不发送订阅消息</option>
{foreach $subscribeTempList as $kv}
<option value="{$kv['value'] ?? ''}">{$kv['name'] ?? ''}</option>
{/foreach}
</select>
</div>
</div>
<div class="layui-form-item sms-select">
<label class="layui-form-label">短信模版</label>
<div class="layui-input-block">
<select class="layui-select" name="item[sms_temp_id]" lay-filter="smsChange">
<option value="">请选择短信模版 不选择则不发送短信</option>
{foreach $smsTempList as $kv}
<option value="{$kv['value'] ?? ''}">{$kv['name'] ?? ''}</option>
{/foreach}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">消息通知</label>
<div class="layui-input-block">
<textarea name="item[content]" class="layui-textarea" placeholder="请输入消息内容【此处内容将会已小程序通知的形式展示】" rows="10">{$item.content ?? ''}</textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn layui-btn-normal" data-url="/manager/push/add" lay-submit lay-filter="saveBtn">确认保存</button>
</div>
</div>
</div>
</div>
</div>
<script>
layui.use([ 'jquery', 'form',"xmSelect","laydate"], function () {
let $ = layui.jquery,
xmSelect = layui.xmSelect,
laydate = layui.laydate,
form = layui.form;
// 监听搜索操作
form.on('select(script_management)', function (data) {
// console.log(data.value);
// console.log(script_management_json);
// console.log(script_management_json[data.value].content);
console.log($(this).parents(".layui-row")
.children(".layui-form-item")
.children(".layui-input-block")
.children(".content")
.length);
$(this).parents(".layui-row").children(".layui-form-item").children(".layui-input-block").children(".content").val(script_management_json[data.value].content)
// $("textarea[name='item[content]']").val();
return false;
});
let curDateTime = date('Y-m-d H:i:s');
laydate.render({
elem: '.msg-send-at'
,type: 'datetime'
,min: curDateTime
,done: function(value, date){ //监听日期被切换
}
});
form.on('select(subscribeChange)', function(data){
const params = {$subscribeTempParams|raw};
let paramList = params[data.value]
$('.subscribe-data').remove();
if (data.value !== '' && params[data.value] !== undefined) {
let html = '<hr class="subscribe-data">';
$.each(paramList, function (index, item) {
html += `
<div class="layui-form-item subscribe-data">
<label class="layui-form-label">${item.name}</label>
<div class="layui-input-block">
<input type="text" name="item[subscribe_data][${item.value}]" placeholder="请输入${item.name} ${item.type == 'datetime' ? '时间格式为2022-01-01 13:33:43' : ''}" class="layui-input" maxlength="100">
</div>
</div>`;
})
html += '<hr class="subscribe-data">'
$('.subscribe-select').after(html);
}
});
form.on('select(smsChange)', function(data){
const params = {$smsTempParams|raw};
let paramList = params[data.value]
$('.sms-data').remove();
if (data.value !== '' && params[data.value] !== undefined && params[data.value].length > 0) {
let html = '';
$.each(paramList, function (index, item) {
if (item.name) {
html += `
<div class="layui-form-item sms-data">
<label class="layui-form-label">${item.name}</label>
<div class="layui-input-block">
<input type="text" name="item[sms_data][${item.value}]" placeholder="请输入短信内容:${item.name}" class="layui-input" maxlength="100">
</div>
</div>`;
}
})
// html += '<hr class="sms-data">'
$('.sms-select').after(html);
}
});
})
</script>
<script src="__MANAGER__/js/push.js?v={:mt_rand()}"></script>