addwxsend.html
11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<include file="public/layout"/>
<body style="background-color: #FFF; overflow: auto;">
<div class="page">
<div class="fixed-bar">
<div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i
class="fa fa-arrow-circle-o-left"></i></a>
<div class="subject">
<h3>添加/修改推送消息</h3>
<h5></h5>
</div>
</div>
</div>
<!--表单数据-->
<form method="post" id="addwxsenddForm">
<div class="ncap-form-default">
<dl class="row">
<dt class="tit" colspan="2">
<label class="" for="typeid"><em>*</em>选择模板</label>
</dt>
<dd class="opt">
<div id="gcategory">
<select name="typeid" id="typeid"
onkeydown="strkeydown(event, this, 'submitBtn')"
class="form-control">
<option value="0">请选择分类</option>
<foreach name="typelist" item="v">
<option value="{$v[typeid]}"
<if condition="$v[typeid] eq $wxsend[typeid]"> selected="selected"</if>
>{$v[typename]}</option>
</foreach>
</select>
</div>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="state"><em>*</em>是否启用</label>
</dt>
<dd class="opt">
<div class="onoff">
<label for="state1" class="cb-enable <if condition=" $wxsend[state] eq 1">selected</if>
">是</label>
<label for="state0" class="cb-disable <if condition=" $wxsend[state] eq 0 ">selected</if>
">否</label>
<input id="state1" name="state" value="1" onkeydown="strkeydown(event, this, 'submitbtn')"
type="radio"
<if condition="$wxsend[state] eq 1"> checked="checked"</if>
>
<input id="state0" name="state" value="0" onkeydown="strkeydown(event, this, 'submitbtn')"
type="radio"
<if condition="$wxsend[state] eq 0"> checked="checked"</if>
>
</div>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="template_id"><em>*</em>微信template_id参数</label>
</dt>
<dd class="opt">
<input type="text" placeholder="微信template_id参数"
onkeydown="strkeydown(event, this, 'submitBtn')" id="template_id"
class="" name="template_id" value="{$wxsend.template_id}" style="width: 600px">
<span class="err cr" id="err_template_id"></span>
<p class="notic"></p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="ac_name">详细跳转地址</label>
</dt>
<dd class="opt">
<input type="text" placeholder="详细跳转地址"
onkeydown="strkeydown(event, this, 'submitBtn')" id="htmlurl"
class="" name="htmlurl" value="{$wxsend.htmlurl}" style="width: 600px">
<span class="err cr" id="err_htmlurl"></span>
<p class="notic"></p>
</dd>
</dl>
<dl class="row" id="wxremark"
<if condition="$wxsend.typeid eq 1012">
<else/>
style='display:none'
</if>
>
<dt class="tit">
<label for=""><em>*</em>内容示例</label>
</dt>
<dd class="opt">
<input type="text" placeholder="" onkeydown="strkeydown(event, this, 'submitBtn')" id="wx_first"
class="" name="wx_first" value="{$wxsend['first']}" style="width: 600px">
<br>购买渠道:线上专门店<br>
购买日期:2018年12月21日
<br>
<input type="text" placeholder="" onkeydown="strkeydown(event, this, 'submitBtn')" id="wx_remark"
class="" name="wx_remark" value="{$wxsend.remark}" style="width: 600px">
</dd>
</dl>
<dl class="row" id="wxremark1"
<if condition="$wxsend.typeid neq 1012">
<else/>
style='display:none'
</if>
>
<dt class="tit">
<label for=""><em></em>模板格式</label>
</dt>
<dd class="opt" id="type_remark">
{$wxsend.type_remark}
</dd>
</dl>
<div class="bot"><a href="JavaScript:void(0);" onClick="checkForm();" class="ncap-btn-big ncap-btn-green"
id="submitBtn">确认提交</a></div>
</div>
<input type="hidden" value="{:curHostURL()}" id="curhttp">
<input type="hidden" value="{:getAdmStoId()}" id="admstoid">
</form>
</div>
<script>
function checkForm() {
var typeid = $("#typeid").val();
if ($.trim(typeid) == '0') {
set_err_msg("请选择模板", "typeid")
return false;
}
var template_id = $("#template_id").val();
if ($.trim(template_id) == '') {
set_err_msg("请输入微信模板Id", "template_id")
$("#template_id").focus();
return false;
}
layer.msg('加载中...', {icon: 16, shade: [0.5, '#f5f5f5'], scrollbar: false, offset: '10px', time: 100000});
$('#addwxsenddForm').submit();
}
// 上传商品图片成功回调函数
function call_back(fileurl_tmp) {
$("#logo").val(fileurl_tmp);
$("#original_img2").attr('onmouseover', "layer.tips('<img src=" + fileurl_tmp + ">',this,{tips: [1, '#fff']});");
$("#original_img2").attr('src', fileurl_tmp);
}
function set_err_msg(text, elem) {
layer.msg(text, {icon: 2, time: 1000});
$("#" + elem).focus();
$("#" + elem).parent().find("span").text(text);
}
$(function () {
var gettemplate_type="{$wxsend.template_type}";
if ($("#typeid").find("option:selected").val()!="0") {
var loadinglayer=layer.msg('加载中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '10px', time:100000}) ;
var thistext = $("#typeid").find("option:selected").text();
var templatetype = '<option value="1">' + thistext + '</option>';
$.ajax({
url: '/index.php?m=Admin&c=Weapp&a=template_typelist&typeid=' + $(this).val(),
type: 'post',
dataType: 'json',
success: function (res) {
if (res.status == 1) {
var arr = res.list;
for (var i = 0; i < arr.length; i++) {
templatetype += '<option value="' + arr[i]['ordid'] + '">' + arr[i]['typename'] + '</option>';
}
}
else {
}
$("#template_type").html(templatetype);
}
})
$.ajax({
url: '/index.php?m=Admin&c=Weapp&a=template_typelist&typeid=' + $("#typeid").val(),
type: 'post',
dataType: 'json',
success: function (res) {
if (res.status == 1) {
var arr = res.list;
for (var i = 0; i < arr.length; i++) {
templatetype += '<option value="' + arr[i]['ordid'] + '" '+(gettemplate_type==arr[i]['ordid']?" selected=selected":"")+'>' + arr[i]['typename'] + '</option>';
}
if (gettemplate_type>1)
{
getremark1(gettemplate_type);
}
}
else {
}
$("#template_type").html(templatetype);
layer.close(loadinglayer);
},
error:function () {
layer.close(loadinglayer);
}
})
}
})
function getremark1(sid) {
var wxurl= '/index.php?m=Admin&c=Weapp&a=getwxremark1&id=' + sid;
if (sid==1)
{
wxurl= '/index.php?m=Admin&c=Weapp&a=getwxremark&typeid=' + $("#typeid").val();
}
var loadinglayer3=layer.msg('加载中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '10px', time:100000}) ;
$.ajax({
url:wxurl,
type: 'post',
dataType: 'json',
success: function (res) {
if (res.status == 1) {
$("#type_remark").html(res.remark);
}
else {
}
layer.close(loadinglayer3);
},
error:function () {
layer.close(loadinglayer3);
}
})
}
$("#typeid").change(function () {
if ($(this).val() != 0) {
$("#divtype").show();
} else {
$("#divtype").hide();
}
var loadinglayer2=layer.msg('加载中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '10px', time:100000}) ;
$.ajax({
url: '/index.php?m=Admin&c=Weapp&a=getwxremark&typeid=' + $(this).val(),
type: 'post',
dataType: 'json',
success: function (res) {
if (res.status == 1) {
$("#type_remark").html(res.remark);
}
else {
}
layer.close(loadinglayer2);
},
error:function () {
layer.close(loadinglayer2);
}
})
var getcurhttp = $("#curhttp").val();
var getstoid = $("#admstoid").val();
switch ($(this).val()) {
case "1001"://订单支付成功通知
$("#htmlurl").val("pages/user/order_list/order_list");
break;
case "1007"://绑定通知
$("#htmlurl").val("pages/user/index/index");
break;
case "1023"://拼团结果通知
$("#htmlurl").val("pages/team/team_order/team_order");
break;
case "1025"://退款成功通知
$("#htmlurl").val("pages/user/order_list/order_list");
break;
default:
$("#htmlurl").val("pages/index/index/index");
break;
}
})
</script>
</body>
</html>