初始上传
This commit is contained in:
328
addon/niusms/shop/view/sms/buy.html
Executable file
328
addon/niusms/shop/view/sms/buy.html
Executable file
@@ -0,0 +1,328 @@
|
||||
<style>
|
||||
.card-common{
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.sms-package-list h3 {
|
||||
border-bottom: 1px solid #f1f1f1;
|
||||
padding: 10px 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.sms-package-list ul {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sms-package-list ul li {
|
||||
border: 1px solid #f1f1f1;
|
||||
float: left;
|
||||
width: 150px;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.sms-package-list ul li .package-name {
|
||||
margin-bottom: 10px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.sms-num {
|
||||
font-size: 24px;
|
||||
margin-bottom: 10px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.sms-package-list ul li .original-price {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.sms-invoice-list h3 {
|
||||
border-bottom: 1px solid #f1f1f1;
|
||||
padding: 10px 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.sms-invoice-list .layui-form-item {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.pay-way h3 {
|
||||
border-bottom: 1px solid #f1f1f1;
|
||||
padding: 10px 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.settlement-wrap ul li {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.settlement-wrap ul li.invoice{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.settlement-wrap ul li label {
|
||||
width: 80px;
|
||||
display: inline-block;
|
||||
text-align: right;
|
||||
}
|
||||
.js-pay-money span{
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="layui-form">
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">选择套餐</span>
|
||||
</div>
|
||||
<div class="layui-card-body sms-package-list">
|
||||
<ul>
|
||||
{foreach name="$sms_package_list['sms_list']" item="vo" key="k"}
|
||||
<li data-package-id="{$vo['package_id']}" {if $k===0 }class="border-color" {/if}>
|
||||
<span class="package-name">{$vo['package_name']}</span>
|
||||
<span class="sms-num text-color">{$vo['sms_num']}条</span>
|
||||
<p>
|
||||
<span class="price">¥{$vo['price']}</span>
|
||||
<span class="original-price text-color-gray">¥{$vo['original_price']}</span>
|
||||
</p>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{notempty name="$sms_package_list['invoice_list']"}
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">发票</span>
|
||||
</div>
|
||||
<div class="layui-card-body sms-invoice-list">
|
||||
<div>
|
||||
<input type="radio" name="invoice" value="0" title="无需发票" lay-filter="invoice" checked>
|
||||
{foreach name="$sms_package_list['invoice_list']" item="vo"}
|
||||
<input type="radio" name="invoice" value="{$vo['id']}" title="{$vo['name']}" lay-filter="invoice" data-rate="{$vo['rate']}" data-type="{$vo['type']}" data-invoice-type="{$vo['invoice_type']}" data-invoice-content="{$vo['invoice_content']}">
|
||||
{/foreach}
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>收件人:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="consigner" lay-verify="required" autocomplete="off" class="layui-input len-mid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>手机号:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="mobile" lay-verify="required" autocomplete="off" class="layui-input len-mid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>邮编:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="zip_code" lay-verify="required" autocomplete="off" class="layui-input len-mid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>收货地址:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="address" lay-verify="required" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>抬头名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="invoice_title" lay-verify="required" autocomplete="off" class="layui-input len-mid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>纳税人识别号:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="invoice_number" lay-verify="required" autocomplete="off" class="layui-input len-mid">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/notempty}
|
||||
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">选择支付方式</span>
|
||||
</div>
|
||||
<div class="layui-card-body pay-way">
|
||||
<input type="radio" name="pay_way" value="alipay" title="支付宝" checked>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settlement-wrap">
|
||||
<ul>
|
||||
{notempty name="$sms_package_list['invoice_list']"}
|
||||
<li class="invoice">
|
||||
<label>税率:</label>
|
||||
<span class="js-rate">0</span>
|
||||
</li>
|
||||
<li class="invoice">
|
||||
<label>类型:</label>
|
||||
<span class="js-type"></span>
|
||||
</li>
|
||||
<li class="invoice">
|
||||
<label>发票类型:</label>
|
||||
<span class="js-invoice-type"></span>
|
||||
</li>
|
||||
<li class="invoice">
|
||||
<label>发票内容:</label>
|
||||
<span class="js-invoice-content"></span>
|
||||
</li>
|
||||
<li class="invoice">
|
||||
<label>税费:</label>
|
||||
<span class="js-invoice-money">¥0.00</span>
|
||||
</li>
|
||||
<li class="invoice">
|
||||
<label>订单金额:</label>
|
||||
<span class="js-order-money">¥0.00</span>
|
||||
</li>
|
||||
{/notempty}
|
||||
<li>
|
||||
<label>应付:</label>
|
||||
<span class="js-pay-money text-color">¥<span class="text-color">0.00</span></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="invoice_id">
|
||||
<input type="hidden" name="invoice_content">
|
||||
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">支付</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="location.hash = ns.hash('niusms://shop/sms/index')">返回</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use('form', function () {
|
||||
var form = layui.form,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
calculate(0, 0);
|
||||
|
||||
form.on('radio(invoice)', function (data) {
|
||||
var rate = $(data.elem).attr("data-rate");
|
||||
var type = $(data.elem).attr("data-type");
|
||||
var type_value = "";
|
||||
if (type == 1) {
|
||||
type_value = "纸质发票";
|
||||
} else if (type == 2) {
|
||||
type_value = "电子发票";
|
||||
}
|
||||
var invoice_type = $(data.elem).attr("data-invoice-type");
|
||||
var invoice_type_value = "";
|
||||
if (invoice_type == 1) {
|
||||
invoice_type_value = "普票";
|
||||
} else if (invoice_type == 2) {
|
||||
invoice_type_value = "专票";
|
||||
}
|
||||
|
||||
var invoice_content = $(data.elem).attr("data-invoice-content");
|
||||
|
||||
calculate(parseInt(data.value) ? 1 : 0, data.value);
|
||||
if (parseInt(data.value)) {
|
||||
$(".js-rate").html("<strong class='text-color'>" + rate + "%</strong>");
|
||||
$(".js-type").text(type_value);
|
||||
$(".js-invoice-type").text(invoice_type_value);
|
||||
$(".js-invoice-content").text(invoice_content);
|
||||
$(".settlement-wrap .invoice").show();
|
||||
$(".sms-invoice-list .layui-form-item").show();
|
||||
$("input[name='invoice_id']").val(data.value);
|
||||
$("input[name='invoice_content']").val(invoice_content);
|
||||
} else {
|
||||
$(".settlement-wrap .invoice").hide();
|
||||
$(".sms-invoice-list .layui-form-item").hide();
|
||||
$("input[name='invoice_id']").val(0);
|
||||
$("input[name='invoice_content']").val('');
|
||||
}
|
||||
});
|
||||
|
||||
$("body").off("click").on("click",".sms-package-list ul li",function () {
|
||||
$(this).addClass("border-color").siblings().removeClass("border-color");
|
||||
|
||||
var isInvoice = parseInt($("input[name='invoice']:checked").val()) ? 1 : 0;
|
||||
var packageId =$(".sms-package-list ul li.border-color").attr("data-package-id");
|
||||
|
||||
calculate(isInvoice, packageId);
|
||||
});
|
||||
|
||||
form.verify({
|
||||
required: function (value, item) {
|
||||
var str = $(item).parent().parent().find("label").text().toString().replace("*", "").replace(":", "");
|
||||
if (parseInt($("input[name='invoice']:checked").val())) {
|
||||
if (value == null || value.trim() == "" || value == undefined || value == null) {
|
||||
return str + "不能为空";
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.on("submit(save)", function (data) {
|
||||
|
||||
data.field.package_id =$(".sms-package-list ul li.border-color").attr("data-package-id");
|
||||
data.field.is_invoice = parseInt($("input[name='invoice']:checked").val()) ? 1 : 0;
|
||||
|
||||
if(repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
var newWin = window.open('about:blank');
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/createSmsOrder"),
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
if (res.code == 0) {
|
||||
newWin.location.href = ns.href("niusms://shop/sms/payment", {out_trade_no: res.data.out_trade_no});
|
||||
var index = layer.confirm('请确认支付是否完成',{
|
||||
title: '支付提示',
|
||||
btn: ['已完成支付', '返回'],
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash('niusms://shop/sms/index');
|
||||
layer.close(index);
|
||||
},btn2: function(index, layero) {
|
||||
repeat_flag = false;
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
repeat_flag = false;
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
function calculate(is_invoice, invoice_id) {
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/calculate"),
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
data: {
|
||||
package_id: $(".sms-package-list ul li.border-color").attr("data-package-id"),
|
||||
is_invoice: is_invoice,
|
||||
invoice_id: invoice_id
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.code >= 0) {
|
||||
var data = res.data;
|
||||
$(".settlement-wrap .js-invoice-money").text("¥" + parseFloat(data.invoice_money).toFixed(2));
|
||||
$(".settlement-wrap .js-order-money").text("¥" + parseFloat(data.order_money).toFixed(2));
|
||||
$(".settlement-wrap .js-pay-money").html("¥" + "<span class='text-color'>" + parseFloat(data.pay_money).toFixed(2) +"</span>");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
80
addon/niusms/shop/view/sms/config.html
Executable file
80
addon/niusms/shop/view/sms/config.html
Executable file
@@ -0,0 +1,80 @@
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" onclick="getSmsPackageList()">获取短信套餐包</button>
|
||||
<button class="layui-btn" onclick="register()">注册</button>
|
||||
<button class="layui-btn" onclick="alert()">发送短信</button>
|
||||
<button class="layui-btn" onclick="removeChildAccount()">删除</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use('form', function() {
|
||||
var form = layui.form,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
form.on('submit(save)', function(data) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("alisms://shop/sms/config"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
layer.confirm('编辑成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表', '继续操作'],
|
||||
yes: function(index, layero){
|
||||
location.hash = ns.hash("shop/message/sms")
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function getSmsPackageList() {
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/getSmsPackageList"),
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
console.log("getSmsPackageList",res);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function register() {
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/register"),
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
console.log("register",res);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function removeChildAccount() {
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/removeChildAccount"),
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
console.log("removeChildAccount",res);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
228
addon/niusms/shop/view/sms/forget.html
Executable file
228
addon/niusms/shop/view/sms/forget.html
Executable file
@@ -0,0 +1,228 @@
|
||||
<style>
|
||||
.form-wrap {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.tips {
|
||||
padding: 10px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.form-row {
|
||||
width: 240px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 100px;
|
||||
height: 34px;
|
||||
}
|
||||
#newPassword {
|
||||
display: inline-block;
|
||||
padding: 0 10px;
|
||||
font-size: 25px;
|
||||
}
|
||||
.btn-code{
|
||||
width: 115px;
|
||||
padding: 0 0px;
|
||||
}
|
||||
.btn-tel-code{
|
||||
width: auto;
|
||||
}
|
||||
.message-html{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
|
||||
<p class="tips bg-color-light-9 text-color">忘记密码,快去修改</p>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">手机号:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="mobiles" lay-verify="required" placeholder="请输入手机号" autocomplete="off" class="layui-input len-mid">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">验证码:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="captcha_code" lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input len-mid">
|
||||
</div>
|
||||
<img class="layui-btn layui-btn-primary btn-code" onclick="captcha()" src="{$captcha.img}" id="captcha_img">
|
||||
<input type="hidden" name="captcha_id" value="{$captcha.id}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">动态码:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="code" lay-verify="required" placeholder="请输入手机动态码" autocomplete="off" class="layui-input len-mid">
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-primary btn-tel-code" onclick="mobileCode()">获取动态码</button>
|
||||
<input type="hidden" name="key" value="">
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">重置密码</button>
|
||||
<button class="layui-btn layui-btn-primary btn-sign" onclick="location.hash = ns.hash('niusms://shop/sms/login')">返回</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--消息内容-->
|
||||
<script type="text/html" id="message_html">
|
||||
<div class="message-html">
|
||||
<span class="span-content">
|
||||
您重置后的密码是:<div id="newPassword"></div>请妥善保存。
|
||||
</span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var form,laytpl,repeat_flag = false; //防重复标识;
|
||||
layui.use(['laydate', 'form', 'laytpl'], function () {
|
||||
form = layui.form,
|
||||
laytpl = layui.laytpl;
|
||||
form.render();
|
||||
|
||||
form.on('submit(save)', function (data) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/forget"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
if (res.code >= 0) {
|
||||
var newPassword = res.data.newPassword;
|
||||
openText();
|
||||
var nav = `<b> ${newPassword} </b>`;
|
||||
$("#newPassword").html(nav);
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
mobiles: function (value) {
|
||||
if (!value.trim()) {
|
||||
return "手机号不能为空";
|
||||
}
|
||||
},
|
||||
captcha_code: function (value) {
|
||||
if (!value.trim()) {
|
||||
return "验证码不能为空";
|
||||
}
|
||||
},
|
||||
code: function (value) {
|
||||
if (!value.trim()) {
|
||||
return "动态码不能为空";
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 手机动态码
|
||||
var sys_second = 60;
|
||||
function mobileCode() {
|
||||
if (sys_second != 60) return;
|
||||
var mobiles = $("input[name='mobiles']").val();
|
||||
var captcha_id = $("input[name='captcha_id']").val();
|
||||
var captcha_code = $("input[name='captcha_code']").val();
|
||||
if (mobiles == "") {
|
||||
layer.msg("手机号不能为空");
|
||||
return false;
|
||||
}
|
||||
if (captcha_id == "") {
|
||||
layer.msg("重新获取验证码");
|
||||
return false;
|
||||
}
|
||||
if (captcha_code == "") {
|
||||
layer.msg("验证码不能为空");
|
||||
return false;
|
||||
}
|
||||
if (!ns.parse_mobile(mobiles)) {
|
||||
layer.msg("请输入正确的手机号");
|
||||
return false;
|
||||
}
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/mobileCode"),
|
||||
data: {mobiles: mobiles, captcha_id: captcha_id, captcha_code: captcha_code},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
if (res.code >= 0) {
|
||||
var timer = setInterval(function() {
|
||||
if (sys_second > 1) {
|
||||
sys_second -= 1;
|
||||
$(".btn-tel-code").text(sys_second + 's后可重新获取');
|
||||
} else {
|
||||
sys_second = 60;
|
||||
clearInterval(timer);
|
||||
$(".btn-tel-code").attr("disabled", false);
|
||||
$(".btn-tel-code").text('获取动态码');
|
||||
$(".btn-tel-code").css("background-color", "#ffffff");
|
||||
}
|
||||
}, 1000);
|
||||
$(".btn-tel-code").attr("disabled", "disabled");
|
||||
$(".btn-tel-code").css("background-color", "#eee");
|
||||
$("input[name='key']").attr("value", res.data.key);
|
||||
layer.msg("发送成功");
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
repeat_flag = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 验证码
|
||||
function captcha() {
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/captcha"),
|
||||
data: {},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
if (res.code >= 0) {
|
||||
$('#captcha_img').attr('src', res.data.img);
|
||||
$("input[name='captcha_id']").attr("value", res.data.id);
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function openText() {
|
||||
laytpl($("#message_html").html()).render([], function (html) {
|
||||
layer.open({
|
||||
title: '重置成功',
|
||||
type: 1,
|
||||
area: ['400px', '150px'], //宽高
|
||||
content: html,
|
||||
cancel: function(index, layero){
|
||||
location.hash = ns.hash("niusms://shop/sms/login");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
715
addon/niusms/shop/view/sms/index.html
Executable file
715
addon/niusms/shop/view/sms/index.html
Executable file
@@ -0,0 +1,715 @@
|
||||
<style>
|
||||
.account-value, .split{line-height: 34px;}
|
||||
.account-value span{font-size: 24px;}
|
||||
.layui-input-block + .layui-word-aux{display: block;margin-left: 100px;}
|
||||
.shop-detail{display: flex;flex-wrap: wrap;width: 940px;}
|
||||
.shop-detail p{display: inline-block;width: 300px;line-height: 30px;}
|
||||
.shop-detail p:last-of-type{width: auto;max-width: 430px;}
|
||||
.card-common{margin-top: 0;}
|
||||
.card-common .layui-card-body{padding: 20px 30px;}
|
||||
.cut{color: var(--base-color);cursor: pointer;}
|
||||
.cut:hover{color: var(--base-color);}
|
||||
.cut:active{color: var(--base-color);}
|
||||
.tel-class{width: 200px;height: 30px;border: 1px solid #ccc;border-radius: 5px;padding-left: 5px;}
|
||||
.code-class{width:100px}
|
||||
.code-last{font-size: 12px;display: inline-block;margin-left: 10px;color: var(--base-color);cursor: pointer;width: 90px;border: 0px}
|
||||
.table-tab .layui-tab-title{margin-bottom: 15px;}
|
||||
.single-filter-box{padding-top: 0;}
|
||||
.tips-wrap{margin-bottom: 20px;}
|
||||
</style>
|
||||
|
||||
<div class="tips-wrap layui-collapse">
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title">操作提示</h2>
|
||||
<ul class="layui-colla-content layui-show">
|
||||
<li>设置短信签名、开启模板消息需要审核。</li>
|
||||
<li>审核时间:周一至周日9:30-22:00(法定节假日顺延),工作日预计2小时,非工作日预计4小时。</li>
|
||||
<li>短信数量不足时,请进行短信充值;如有疑问,请联系客服,客服电话:400-886-7993。</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">短信信息</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="shop-detail">
|
||||
<p>
|
||||
<strong>用户名:</strong><span>{$account_info.username}</span>
|
||||
<a class="cut" onclick="location.hash = ns.hash('niusms://shop/sms/login')">切换账户</a>
|
||||
</p>
|
||||
<p><strong>公司名称:</strong><span>{$account_info.company}</span></p>
|
||||
<p><strong>账户状态:</strong><span>{if $account_info.status == 0}正常{elseif $account_info.status == 1}禁用{/if}</span>
|
||||
</p>
|
||||
<p><strong>手机号:</strong><span>{$account_info.mobiles}</span>
|
||||
<span class="cut" onclick="updateTel()"> 更换手机号</span>
|
||||
</p>
|
||||
<p><strong>签名:</strong>
|
||||
{notempty name="$sms_config.value.signature"}
|
||||
<span>{$sms_config.value.signature}</span>
|
||||
{else/}
|
||||
<span>暂无</span>
|
||||
{/notempty}
|
||||
{if $signature_status.auditResult == 1}
|
||||
<span>待审核</span>
|
||||
{elseif $signature_status.auditResult == 3 /}
|
||||
<span>审核失败 <span style="color:red;">(失败原因:{$signature_status.auditMsg})</span></span>
|
||||
{/if}
|
||||
{notempty name="$sms_config.value.signature"}
|
||||
<a class="cut" onclick="addChildSignature('{$sms_config.value.signature}')">更换签名</a>
|
||||
{else/}
|
||||
<a class="cut" onclick="addChildSignature('')">签名设置</a>
|
||||
{/notempty}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">短信权限</span>
|
||||
</div>
|
||||
<div class="layui-card-body layui-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">是否开启:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_use" value="1" lay-skin="switch" lay-filter="is_use" {if $sms_config['is_use']}checked{/if}>
|
||||
</div>
|
||||
<div class="word-aux sm">是否开启牛云短信模版</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">短信条数</span>
|
||||
</div>
|
||||
<div class="layui-card-body layui-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">短信:</label>
|
||||
<div class="layui-input-inline len-short account-value">
|
||||
<span class="text-color">{$account_info.balance}</span>
|
||||
条
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-primary" onclick="location.hash = ns.hash('niusms://shop/sms/index',{buy : 1})" data-num="point">短信充值
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab table-tab" lay-filter="store_tab">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this" lay-id="">短信模版</li>
|
||||
<li lay-id="0">充值记录</li>
|
||||
<li lay-id="1">发送记录</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<table id="sms_template_list" lay-filter="sms_template_list"></table>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<table id="recharge_sms_list" lay-filter="recharge_sms_list"></table>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<div class="single-filter-box">
|
||||
<div class="layui-form">
|
||||
<div class="layui-input-inline">
|
||||
<label class="layui-form-label">发送状态:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="status">
|
||||
<option value="all">全部</option>
|
||||
<option value="1">待发送</option>
|
||||
<option value="2">发送成功</option>
|
||||
<option value="-1">发送失败</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="search_text" placeholder="请输入短信标题" autocomplete="off" class="layui-input">
|
||||
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit><i class="layui-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="sms_list" lay-filter="sms_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--操作-->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="examine">查看</a>
|
||||
{{# if(d.status == 1){ }}
|
||||
<a class="layui-btn" lay-event="close">关闭</a>
|
||||
{{# }else{ }}
|
||||
<a class="layui-btn" lay-event="open">开启</a>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!--<script type="text/html" id="sms_template_info">-->
|
||||
<!-- <div class="layui-form">-->
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">模板变量json:</label>-->
|
||||
<!-- <div class="layui-input-inline">{{d.param_json}}</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!--</script>-->
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="grantOperation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="detail">详情</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 更换手机号 -->
|
||||
<script type="text/html" id="set_tel">
|
||||
<div class="layui-form member-form" id="reset_label" lay-filter="form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">手机号:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" class="tel-class" name="tel"/>
|
||||
<input type="hidden" name="username_to" value="{$account_info.username}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn" lay-submit lay-filter="setlabel">确定</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closeLabel()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 验证码效验 -->
|
||||
<script type="text/html" id="code_tel">
|
||||
<div class="layui-form member-form" lay-filter="form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">动态码:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" class="tel-class code-class" name="code" placeholder="请输入动态码"/>
|
||||
<input class="register-message-font code-last"onclick="getCode()" value="获取动态码" readonly />
|
||||
<input type="hidden" id="code_mobile" name="code_mobile" value="{$account_info.mobiles}">
|
||||
<input type="hidden" name="key" value="" id="key">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row sm">
|
||||
<button class="layui-btn" lay-submit lay-filter="setCode">确定</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closeCodeLabel()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var form, laytpl, table,
|
||||
layer_label,
|
||||
code_label,
|
||||
count = 60,
|
||||
curCount,
|
||||
interValObj;
|
||||
|
||||
layui.use(['form', 'laytpl'], function () {
|
||||
form = layui.form;
|
||||
laytpl = layui.laytpl;
|
||||
form.render();
|
||||
|
||||
form.on('switch(is_use)', function (data) {
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/modifyConfigIsUse"),
|
||||
data: {is_use: data.elem.checked ? 1 : 0},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* 加载表格
|
||||
*/
|
||||
table = new Table({
|
||||
elem: '#sms_template_list',
|
||||
url: ns.url("niusms://shop/sms/getSmsTemplatePageList"),
|
||||
cols: [
|
||||
[
|
||||
// {
|
||||
// width: "3%",
|
||||
// type: 'checkbox',
|
||||
// unresize: 'false'
|
||||
// },
|
||||
{
|
||||
field: 'tem_id',
|
||||
title: '模板ID',
|
||||
width: '7%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'template_name',
|
||||
title: '模板名称',
|
||||
width: '13%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
title: '模板类型',
|
||||
width: '8%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
if (data.template_type == 1) return '验证码';
|
||||
else if (data.template_type == 2) return '行业通知';
|
||||
else if (data.template_type == 3) return '营销推广';
|
||||
}
|
||||
}, {
|
||||
field: 'template_content',
|
||||
title: '模板内容',
|
||||
width: '46%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '开关状态',
|
||||
width: '8%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
if (data.status == 1) return '启用';
|
||||
else if (data.status == 0) return '关闭';
|
||||
}
|
||||
}, {
|
||||
field: 'audit_status_name',
|
||||
title: '审核状态',
|
||||
width: '9%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
var html = '';
|
||||
if (data.audit_status != 0 && data.audit_status != 2) html += "<span style='color: red;'>" + data.audit_status_name + "</span>";
|
||||
else html += data.audit_status_name;
|
||||
return html;
|
||||
}
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
align:'right'
|
||||
}]
|
||||
],
|
||||
// bottomToolbar: "#batchOperation"
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作商家拒绝退款
|
||||
*/
|
||||
table.tool(function (obj) {
|
||||
var data = obj.data,
|
||||
event = obj.event;
|
||||
switch (obj.event) {
|
||||
// case 'select':
|
||||
// var html = $("#sms_template_info").html();
|
||||
// laytpl(html).render(data, function (html) {
|
||||
// layerIndex = layer.open({
|
||||
// title: '短信模板详情',
|
||||
// skin: 'layer-tips-class',
|
||||
// type: 1,
|
||||
// area: ['650px'],
|
||||
// content: html,
|
||||
// success: function () {
|
||||
// form.render();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// break;
|
||||
case 'examine':
|
||||
window.open(ns.href("niusms://shop/message/edit", {"keywords": data.keywords}));
|
||||
break;
|
||||
case 'open':
|
||||
enableTemplate(data.template_id, 1);
|
||||
break;
|
||||
case 'close':
|
||||
enableTemplate(data.template_id, 0);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// // 批量操作
|
||||
// table.bottomToolbar(function (obj) {
|
||||
//
|
||||
// if (obj.data.length < 1) {
|
||||
// layer.msg('请选择要操作的数据');
|
||||
// return;
|
||||
// }
|
||||
// var id_array = new Array();
|
||||
// for (i in obj.data) id_array.push(obj.data[i].template_id);
|
||||
// switch (obj.event) {
|
||||
// case "batch_open":
|
||||
// //批量开启
|
||||
// for (var i = 0; i < id_array.length; i++) {
|
||||
// enableTemplate(id_array[i],1);
|
||||
// }
|
||||
// break;
|
||||
// case 'batch_close':
|
||||
// //批量关闭
|
||||
// enableTemplate(id_array.toString(),0);
|
||||
// break;
|
||||
// case 'batch_check':
|
||||
// //批量审核
|
||||
// layer.open({
|
||||
// title: "批量设置",
|
||||
// type: 1,
|
||||
// area: ['700px', '600px'],
|
||||
// content: $('#batchSet').html(),
|
||||
// success: function(){
|
||||
// form.render();
|
||||
// }
|
||||
// })
|
||||
// break;
|
||||
// }
|
||||
// });
|
||||
|
||||
/* 发送记录 */
|
||||
grantTable = new Table({
|
||||
elem: '#sms_list',
|
||||
url: ns.url("shop/message/smsRecords"),
|
||||
cols: [
|
||||
[{
|
||||
field: 'keywords_name',
|
||||
title: '标题',
|
||||
width: '20%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'account',
|
||||
title: '接收人账号',
|
||||
width: '12%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
width: '15%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
field: 'send_time',
|
||||
title: '发送时间',
|
||||
width: '15%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return ns.time_to_date(data.send_time);
|
||||
}
|
||||
}, {
|
||||
title: '发送状态',
|
||||
width: '18%',
|
||||
unresize: 'false',
|
||||
templet: '#grantStatus'
|
||||
}, {
|
||||
title: '操作',
|
||||
width: '20%',
|
||||
unresize: 'false',
|
||||
templet: '#grantOperation',
|
||||
align:'right'
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
grantTable.tool(function (obj) {
|
||||
if (obj.event == "detail") {
|
||||
var detailHtml = $("#smsDetail").html();
|
||||
laytpl(detailHtml).render(obj.data, function (html) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '通知详情',
|
||||
area: ['550px'],
|
||||
content: html
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function (data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
|
||||
form.on('submit(setlabel)', function(data) {
|
||||
if(data.field.tel == ""){
|
||||
layer.msg('请输入手机号');
|
||||
return ;
|
||||
}
|
||||
if (!ns.parse_mobile(data.field.tel)) {
|
||||
layer.msg('请输入正确的手机号码!');
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ns.url("niusms://shop/sms/updateNiusmsTel"),
|
||||
data: {
|
||||
tel : data.field.tel,
|
||||
username : data.field.username_to
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
layer.closeAll();
|
||||
listenerHash(); // 刷新页面
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('submit(setCode)', function(data) {
|
||||
if (data.field.code == ""){
|
||||
layer.msg("请输入动态码");
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ns.url("niusms://shop/sms/codeValidate"),
|
||||
data: {
|
||||
code : data.field.code,
|
||||
code_mobile : data.field.code_mobile,
|
||||
key : data.field.key
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function(res) {
|
||||
layer.close(code_label);
|
||||
if(res == 1){
|
||||
layer_label = layer.open({
|
||||
title: '更换手机号',
|
||||
skin: 'layer-tips-class',
|
||||
type: 1,
|
||||
area: ['450px'],
|
||||
content: $("#set_tel").html(),
|
||||
});
|
||||
}else{
|
||||
layer.msg("动态码不正确");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* 充值记录 */
|
||||
rechargeTable = new Table({
|
||||
elem: '#recharge_sms_list',
|
||||
url: ns.url("niusms://shop/sms/getSmsOrderList"),
|
||||
cols: [
|
||||
[{
|
||||
field: 'order_no',
|
||||
title: '订单编号',
|
||||
width: '20%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'package_name',
|
||||
title: '短信套餐',
|
||||
width: '15%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'sms_num',
|
||||
title: '短信条数',
|
||||
width: '10%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '订单总价',
|
||||
width: '15%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
var value = data.order_money;
|
||||
return value;
|
||||
}
|
||||
}, {
|
||||
field: 'pay_money',
|
||||
title: '实付金额',
|
||||
width: '10%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
title: '订单状态',
|
||||
width: '10%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
var start = data.order_status == 0 ? '待支付' : data.order_status == 1 ? '已支付' : '已关闭';
|
||||
return start;
|
||||
}
|
||||
}, {
|
||||
title: '付款时间',
|
||||
width: '18%',
|
||||
unresize: 'false',
|
||||
templet: function (res) {
|
||||
return ns.time_to_date(res.create_time);
|
||||
}
|
||||
}]
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
function enableTemplate(template_id, status) {
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/template/enableTemplate"),
|
||||
data: {template_id: template_id, status: status},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
if (res.code >= 0) {
|
||||
listenerHash(); // 刷新页面
|
||||
}
|
||||
layer.msg(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addChildSignature(signature) {
|
||||
var url = ns.url("niusms://shop/sms/signlist",{request_mode: 'iframe'});
|
||||
|
||||
var layerIndex = layer.open({
|
||||
title: "签名管理",
|
||||
type: 2,
|
||||
area: ['1200px', '800px'],
|
||||
content: url,
|
||||
end: function () {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.closeAll();
|
||||
}
|
||||
});
|
||||
|
||||
// signature = signature.replace("【","").replace("】","");
|
||||
// layer.prompt({
|
||||
// formType: 2,
|
||||
// title: '请输入短信签名',
|
||||
// value: signature,
|
||||
// }, function(value, index, elem){
|
||||
// $.ajax({
|
||||
// url: ns.url("niusms://shop/sms/addChildSignature"),
|
||||
// data: {signature: value},
|
||||
// dataType: 'JSON',
|
||||
// type: 'POST',
|
||||
// success: function (res) {
|
||||
// var successList = res.data.successList;
|
||||
// var failList = res.data.failList;
|
||||
// if(successList.length){
|
||||
// layer.msg(successList[0].msg);
|
||||
// }else if(failList.length){
|
||||
// layer.msg(failList[0].msg);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// layer.close(index);
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
function updateTel(){
|
||||
code_label = layer.open({
|
||||
title: "获取动态码",
|
||||
skin: 'layer-tips-class',
|
||||
type: 1,
|
||||
area: ['450px'],
|
||||
content: $("#code_tel").html(),
|
||||
});
|
||||
}
|
||||
function getCode(){
|
||||
var mobile = $("#code_mobile").val();
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/getMobileCode"),
|
||||
data: {mobile: mobile},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
if(res['code'] >= 0){
|
||||
|
||||
curCount = count;
|
||||
$(".code-last").attr("disabled", true);
|
||||
$(".code-last").val(curCount + "秒后重新获取");
|
||||
interValObj = setInterval(setRemainTime, 1000); // 启动计时器timer处理函数,1秒执行一次
|
||||
|
||||
$("#key").val(res['key']);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function closeCodeLabel(){
|
||||
// curCount = 0;
|
||||
layer.close(code_label);
|
||||
}
|
||||
function closeLabel() {
|
||||
layer.close(layer_label);
|
||||
}
|
||||
|
||||
//timer处理函数
|
||||
function setRemainTime() {
|
||||
if (curCount == 0) { // 超时重新获取验证码
|
||||
window.clearInterval(interValObj);// 停止计时器
|
||||
$(".code-last").attr("disabled", false);
|
||||
$(".code-last").val("获取验证码");
|
||||
}else {
|
||||
curCount--;
|
||||
$(".code-last").attr("disabled", true);
|
||||
$(".code-last").val(curCount + "秒后重新获取");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script type="text/html" id="smsDetail">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="80%">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>接收账号</td>
|
||||
<td colspan="3">{{d.account}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>通知名称</td>
|
||||
<td colspan="3">{{d.keywords_name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>创建时间</td>
|
||||
<td colspan="3">{{ns.time_to_date(d.create_time)}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>发送时间</td>
|
||||
<td colspan="3">{{ns.time_to_date(d.send_time)}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>状态</td>
|
||||
<td>{{# if(d.status == 0){ }}发送中
|
||||
{{# }else if(d.status == 1){ }}发送成功
|
||||
{{# }else{ }}发送失败
|
||||
{{# } }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>通知内容</td>
|
||||
<td colspan="3">{{d.content}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>返回结果</td>
|
||||
<td colspan="3">{{d.result}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
||||
|
||||
<!-- 批量操作 -->
|
||||
<!--<script type="text/html" id="batchOperation">-->
|
||||
<!--<button class="layui-btn layui-btn-primary" lay-event="batch_open">批量开启</button>-->
|
||||
<!--<button class="layui-btn layui-btn-primary" lay-event="batch_close">批量关闭</button>-->
|
||||
<!--</script>-->
|
||||
|
||||
<!-- 状态 -->
|
||||
<script type="text/html" id="grantStatus">
|
||||
{{# if(d.status == 0){ }}
|
||||
<span>待发送</span>
|
||||
{{# }else if(d.status == 1){ }}
|
||||
<span>发送成功</span>
|
||||
{{# }else{ }}
|
||||
<span>发送失败</span>
|
||||
{{# } }}
|
||||
</script>
|
||||
72
addon/niusms/shop/view/sms/login.html
Executable file
72
addon/niusms/shop/view/sms/login.html
Executable file
@@ -0,0 +1,72 @@
|
||||
<style>
|
||||
.form-wrap {
|
||||
margin-top: 0;
|
||||
}
|
||||
.tips {
|
||||
padding: 10px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.form-row{
|
||||
width: 240px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
button{
|
||||
width:100px;
|
||||
height:34px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
|
||||
<p class="tips bg-color-light-9 text-color">还未注册牛云短信?<a href="{:href_url('niusms://shop/sms/register')}">去注册</a></p>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户名:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">密码:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" name="password" lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">登录</button>
|
||||
<button class="layui-btn layui-btn-primary btn-sign" onclick="location.hash = ns.hash('niusms://shop/sms/forget')">忘记密码</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use('form', function () {
|
||||
var form = layui.form,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
form.on('submit(save)', function (data) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/login"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
if (res.code == 0) {
|
||||
layer.msg("登录成功");
|
||||
location.hash = ns.hash("niusms://shop/sms/index");
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
40
addon/niusms/shop/view/sms/pay_result.html
Executable file
40
addon/niusms/shop/view/sms/pay_result.html
Executable file
@@ -0,0 +1,40 @@
|
||||
<style>
|
||||
.pay-wrap{
|
||||
text-align: center;
|
||||
}
|
||||
.pay-wrap .pay-text {
|
||||
font-size: 16px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.pay-wrap .pay-money {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.pay-wrap .pay-footer {
|
||||
margin-top: 30px;
|
||||
}
|
||||
.form-wrap{
|
||||
margin-top: 250px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
{notempty name="$order_info"}
|
||||
<div class="pay-wrap">
|
||||
{if $order_info.order_status == 1}
|
||||
<div class="pay-icon"><img src="NIU_SMS_IMG/pay_success.png"/></div>
|
||||
<div class="pay-text">支付成功</div>
|
||||
{else/}
|
||||
<div class="pay-icon"><img src="NIU_SMS_IMG/pay_error.png"/></div>
|
||||
<div class="pay-text">支付失败</div>
|
||||
{/if}
|
||||
<div class="pay-money text-color">支付金额:¥{$order_info.pay_money}</div>
|
||||
<div class="pay-footer">
|
||||
<button class="layui-btn layui-btn-primary" onclick="location.hash = ns.hash('niusms://shop/sms/index')">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
{else/}
|
||||
<p class="error">支付失败</p>
|
||||
{/notempty}
|
||||
</div>
|
||||
253
addon/niusms/shop/view/sms/register.html
Executable file
253
addon/niusms/shop/view/sms/register.html
Executable file
@@ -0,0 +1,253 @@
|
||||
<style>
|
||||
.form-wrap {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.tips {
|
||||
padding: 10px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.btn-tel-code {
|
||||
width: 115px;
|
||||
}
|
||||
|
||||
.btn-code {
|
||||
width: 115px;
|
||||
padding: 0 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
|
||||
<p class="tips bg-color-light-9 text-color">已有账号,<a href="{:href_url('niusms://shop/sms/login')}">去登录</a></p>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户名:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" lay-verify="username" placeholder="请输入用户名" autocomplete="off" class="layui-input len-long">
|
||||
<span class="layui-word-aux">仅支持6~50位英文+数字组合,不支持下划线</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">密码:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="password" lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">公司名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="company" lay-verify="required" placeholder="请输入公司名称" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">手机号:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="mobiles" lay-verify="required" placeholder="请输入手机号" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">验证码:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="captcha_code" lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input len-mid">
|
||||
</div>
|
||||
<img class="layui-btn layui-btn-primary btn-code" onclick="captcha()" src='{notempty name="$captcha.img"}{$captcha.img}{/notempty}' id="captcha_img">
|
||||
<input type="hidden" name="captcha_id" value='{notempty name="$captcha.id"}{$captcha.id}{/notempty}'>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">动态码:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="code" lay-verify="required" placeholder="请输入手机动态码" autocomplete="off" class="layui-input len-mid">
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-primary btn-tel-code" onclick="mobileCode()">获取动态码</button>
|
||||
<input type="hidden" name="key" value="">
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">手机端网址:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="domain" lay-verify="required" placeholder="请输入手机端网址" autocomplete="off" class="layui-input len-long">
|
||||
<span class="layui-word-aux">请输入手机端网址,方便审核。网址错误,可能导致短信签名、模板审核不通过</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">注册</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use('form', function () {
|
||||
var form = layui.form,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
form.verify({
|
||||
username: function (value) {
|
||||
if (value.length == 0) {
|
||||
return "请输入用户名";
|
||||
}
|
||||
if (value.indexOf("_") != -1) {
|
||||
return "不支持下划线";
|
||||
}
|
||||
if (!/^[0-9a-zA-z]{6,50}$/.test(value)) {
|
||||
return "仅支持6~50位英文+数字组合";
|
||||
}
|
||||
},
|
||||
mobiles: function (value) {
|
||||
if (!value.trim()) {
|
||||
return "手机号不能为空";
|
||||
}
|
||||
},
|
||||
captcha_code: function (value) {
|
||||
if (!value.trim()) {
|
||||
return "验证码不能为空";
|
||||
}
|
||||
},
|
||||
code: function (value) {
|
||||
if (!value.trim()) {
|
||||
return "动态码不能为空";
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
form.on('submit(save)', function (data) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/register"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
layer.msg("注册成功");
|
||||
location.hash = ns.hash("niusms://shop/sms/index");
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 手机动态码
|
||||
function mobileCode() {
|
||||
var mobiles = $("input[name='mobiles']").val();
|
||||
var captcha_id = $("input[name='captcha_id']").val();
|
||||
var captcha_code = $("input[name='captcha_code']").val();
|
||||
if (mobiles == "") {
|
||||
layer.msg("手机号不能为空");
|
||||
return false;
|
||||
}
|
||||
if (captcha_id == "") {
|
||||
layer.msg("重新获取验证码");
|
||||
return false;
|
||||
}
|
||||
if (captcha_code == "") {
|
||||
layer.msg("验证码不能为空");
|
||||
return false;
|
||||
}
|
||||
if (!ns.parse_mobile(mobiles)) {
|
||||
layer.msg("请输入正确的手机号");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/mobileCode"),
|
||||
data: {mobiles: mobiles, captcha_id: captcha_id, captcha_code: captcha_code},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
$(".btn-tel-code").attr("disabled", "disabled");
|
||||
$(".btn-tel-code").css("background-color", "#bdbcbc");
|
||||
//倒计时
|
||||
var d = new Date();
|
||||
d.setSeconds(d.getSeconds() + 59);
|
||||
var m = d.getMonth() + 1;
|
||||
var time = d.getFullYear() + '-' + m + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
|
||||
|
||||
var id = ".btn-tel-code";
|
||||
var end_time = new Date(Date.parse(time.replace(/-/g, "/"))).getTime(),
|
||||
//月份是实际月份-1
|
||||
sys_second = (end_time - new Date().getTime()) / 1000;
|
||||
var timer = setInterval(function () {
|
||||
if (sys_second > 1) {
|
||||
sys_second -= 1;
|
||||
var day = Math.floor((sys_second / 3600) / 24);
|
||||
var hour = Math.floor((sys_second / 3600) % 24);
|
||||
var minute = Math.floor((sys_second / 60) % 60);
|
||||
var second = Math.floor(sys_second % 60);
|
||||
var time_text = '';
|
||||
if (day > 0) {
|
||||
time_text += day + '天';
|
||||
}
|
||||
if (hour > 0) {
|
||||
if (hour < 10) {
|
||||
hour = '0' + hour;
|
||||
}
|
||||
time_text += hour + '小时';
|
||||
}
|
||||
if (minute > 0) {
|
||||
if (minute < 10) {
|
||||
minute = '0' + minute;
|
||||
}
|
||||
time_text += minute + '分';
|
||||
}
|
||||
if (second > 0) {
|
||||
if (second < 10) {
|
||||
second = '0' + second;
|
||||
}
|
||||
time_text += second + '秒';
|
||||
}
|
||||
$(id).text(time_text);
|
||||
} else {
|
||||
clearInterval(timer);
|
||||
$(".btn-tel-code").attr("disabled", false);
|
||||
$(".btn-tel-code").text('获取动态码');
|
||||
$(".btn-tel-code").css("background-color", "#ffffff");
|
||||
}
|
||||
},
|
||||
1000);
|
||||
if (res.code >= 0) {
|
||||
$("input[name='key']").attr("value", res.data.key);
|
||||
layer.msg("发送成功");
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 验证码
|
||||
function captcha() {
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/captcha"),
|
||||
data: {},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
if (res.code >= 0) {
|
||||
$('#captcha_img').attr('src', res.data.img);
|
||||
$("input[name='captcha_id']").attr("value", res.data.id);
|
||||
} else {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
419
addon/niusms/shop/view/sms/sign_list.html
Executable file
419
addon/niusms/shop/view/sms/sign_list.html
Executable file
@@ -0,0 +1,419 @@
|
||||
<style>
|
||||
.addsign {
|
||||
margin-left: 10px
|
||||
}
|
||||
|
||||
.line-feed {
|
||||
white-space: break-spaces;
|
||||
}
|
||||
|
||||
.word-aux {
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
color: rgb(178, 178, 178);
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.signature-annotation {
|
||||
display: inline-block;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
padding: 0 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="single-filter-box">
|
||||
<span>
|
||||
<button class="layui-btn addsign" onclick="add()">添加短信签名</button>
|
||||
<button class="layui-btn addsign" onclick="refresh()">刷新</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab table-tab" lay-filter="sign_tab">
|
||||
|
||||
<div class="layui-tab-content">
|
||||
<!-- 列表 -->
|
||||
<table id="sign_list" lay-filter="sign_list"></table>
|
||||
<input class="signature" type="hidden" value="{$sms_config['signature']}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="use_status">
|
||||
{{# if(d.sign == "{$sms_config['signature']}" ){ }}
|
||||
使用中
|
||||
{{# }else { }}
|
||||
未使用
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
<!-- 审核状态 -->
|
||||
<script type="text/html" id="status">
|
||||
{{# if(d.auditResult == 1){ }}
|
||||
<span style="color:red">待审核</span>
|
||||
{{# }else if(d.auditResult == 2){ }}
|
||||
<span style="color:green">审核通过</span>
|
||||
{{# }else if(d.auditResult == 3){ }}
|
||||
<p style="color:grey">审核不通过</p>
|
||||
<p style="color:red" class="line-feed" title="{{ d.auditMsg }}">({{ d.auditMsg }})</p>
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
{{# if(d.sign != "{$sms_config['signature']}" && d.auditResult == 2){ }}
|
||||
<a class="layui-btn" lay-event="use">使用</a>
|
||||
{{# } }}
|
||||
{{# if(d.auditResult != 2){ }}
|
||||
<a class="layui-btn" lay-event="delete">删除</a>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var table, laytpl, element, repeat_flag, form, layer_signature;
|
||||
layui.use(['form', 'element', 'laytpl'], function () {
|
||||
laytpl = layui.laytpl;
|
||||
form = layui.form;
|
||||
element = layui.element;
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
element.on('tab(sign_tab)', function () {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
'status': this.getAttribute('data-status')
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
table = new Table({
|
||||
elem: '#sign_list',
|
||||
url: ns.url("niusms://shop/sms/signlist"),
|
||||
parseData: function (res) { //res 即为原始返回的数据
|
||||
return {
|
||||
"code": 0, //解析接口状态
|
||||
"msg": res.msg, //解析提示文本
|
||||
"count": res.data.page.total, //解析数据长度
|
||||
"data": res.data.signatures //解析数据列表
|
||||
};
|
||||
},
|
||||
cols: [
|
||||
[{
|
||||
field: 'sign',
|
||||
title: '签名名称',
|
||||
unresize: 'false',
|
||||
width: '15%'
|
||||
}, {
|
||||
title: '使用状态',
|
||||
unresize: 'false',
|
||||
templet: '#use_status',
|
||||
width: '15%'
|
||||
}, {
|
||||
title: '审核状态',
|
||||
unresize: 'false',
|
||||
templet: '#status',
|
||||
width: '45%'
|
||||
}, {
|
||||
title: '添加时间',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: function (data) {
|
||||
return ns.millisecond_to_date(data.createTime);
|
||||
}
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align:'right'
|
||||
}]
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* 搜索功能
|
||||
*/
|
||||
form.on('submit(search)', function (data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function (obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'use': //使用
|
||||
changeSign(data.sign);
|
||||
break;
|
||||
case 'delete': //删除
|
||||
deleteSign(data.sign);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 使用签名
|
||||
*/
|
||||
function changeSign(sign) {
|
||||
|
||||
layer.confirm('确定要使用该签名?', function (index) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/changeSignature"),
|
||||
data: {
|
||||
signature: sign
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
parent.listenerHash(); // 刷新页面
|
||||
parent.layer.closeAll();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function () {
|
||||
layer.close();
|
||||
repeat_flag = false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用签名
|
||||
*/
|
||||
function deleteSign(sign) {
|
||||
|
||||
layer.confirm('确定要删除该签名吗?删除操作会有一定延迟,如果删除后还能看到签名数据请刷新列表。', function (index) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("niusms://shop/sms/deleteSignature"),
|
||||
data: {
|
||||
signature: sign
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
layer.closeAll();
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function () {
|
||||
layer.close();
|
||||
repeat_flag = false;
|
||||
});
|
||||
}
|
||||
|
||||
form.verify({
|
||||
mobile: function (value){
|
||||
if(!ns.getRegexp('mobile').test(value)){
|
||||
return '请输入正确的手机号';
|
||||
}
|
||||
},
|
||||
id_card: function (value){
|
||||
if(!ns.getRegexp('idcard15').test(value) && !ns.getRegexp('idcard18').test(value)){
|
||||
return '请输入正确的身份证号';
|
||||
}
|
||||
},
|
||||
img_url: function (value){
|
||||
let sign_source = $("input[name=sign_source]:checked").val();
|
||||
//企业单位和事业单位可以不填,其他的必填
|
||||
if(sign_source !== '1' && sign_source !== '2' && !value){
|
||||
return '请上传图片';
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
form.on('radio(sign_source)', function (data){
|
||||
if(data.value === '1' || data.value === '2'){
|
||||
$("#img_url_required").hide();
|
||||
}else{
|
||||
$("#img_url_required").show();
|
||||
}
|
||||
})
|
||||
|
||||
//添加签名
|
||||
form.on('submit(add_signature)', function (data) {
|
||||
|
||||
var signature = data.field.signature;
|
||||
if (signature.trim().length == 0) {
|
||||
layer.msg("请填写短信签名!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: ns.url("niusms://shop/sms/addChildSignature"),
|
||||
async: true,
|
||||
dataType: 'json',
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
repeat_flag = false;
|
||||
layer.msg(res.message, {}, function () {
|
||||
if (res.code == 0) {
|
||||
layer.closeAll();
|
||||
table.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function add() {
|
||||
laytpl($("#add_signature").html()).render({}, function (html) {
|
||||
layer_signature = layer.open({
|
||||
title: '添加短信签名',
|
||||
skin: 'layer-tips-class',
|
||||
type: 1,
|
||||
area: ['800px', '730px'], //自定义文本域宽高
|
||||
content: html,
|
||||
success: ()=>{
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
|
||||
var upload = new Upload({
|
||||
elem: '#imgUploadGoods'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function refresh(){
|
||||
table.reload();
|
||||
}
|
||||
|
||||
function closeSignature() {
|
||||
layer.close(layer_signature);
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- 添加签名html -->
|
||||
<script type="text/html" id="add_signature">
|
||||
<div class="layui-form" lay-filter="form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>短信签名:</label>
|
||||
<div class="layui-input-block mid">
|
||||
<input type="text" name="signature" lay-verify="required" placeholder="请输入短信签名" autocomplete="off" class="layui-input len-long">
|
||||
<span class="layui-word-aux signature-annotation">字数要求在2-20个字符,不能使用空格和特殊符号“ - + = * & % # @ ~等;</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>企业名称:</label>
|
||||
<div class="layui-input-block mid">
|
||||
<input type="text" name="company_name" lay-verify="required" placeholder="请输入企业名称" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>社会统一信用代码:</label>
|
||||
<div class="layui-input-block mid">
|
||||
<input type="text" name="credit_code" lay-verify="required" placeholder="请输入社会统一信用代码" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>法人姓名:</label>
|
||||
<div class="layui-input-block mid">
|
||||
<input type="text" name="legal_person" lay-verify="required" placeholder="请输入法人姓名" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>经办人姓名:</label>
|
||||
<div class="layui-input-block mid">
|
||||
<input type="text" name="principal_name" lay-verify="required" placeholder="请输入经办人姓名" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>经办人身份证:</label>
|
||||
<div class="layui-input-block mid">
|
||||
<input type="text" name="principal_id_card" lay-verify="required|id_card" placeholder="请输入经办人身份证" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid"><span class="required">*</span>经办人手机号:</label>
|
||||
<div class="layui-input-block mid">
|
||||
<input type="text" name="principal_mobile" lay-verify="required|mobile" placeholder="请输入经办人手机号" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid">签名来源:</label>
|
||||
<div class="layui-input-block mid">
|
||||
<input type="radio" name="sign_source" value="1" title="企业名称" lay-filter="sign_source">
|
||||
<input type="radio" name="sign_source" value="2" title="事业单位" lay-filter="sign_source">
|
||||
<input type="radio" name="sign_source" value="3" title="商标(需提供商标图片)" lay-filter="sign_source">
|
||||
<input type="radio" name="sign_source" value="4" title="APP(需提供APP截图)" lay-filter="sign_source">
|
||||
<input type="radio" name="sign_source" value="5" title="小程序(需提供小程序截图)" lay-filter="sign_source" checked>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mid">签名类型:</label>
|
||||
<div class="layui-input-block mid">
|
||||
<input type="radio" name="sign_type" value="0" title="全称" lay-filter="sign_source" >
|
||||
<input type="radio" name="sign_type" value="1" title="简称" lay-filter="sign_source" checked>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item goods-image-wrap">
|
||||
<label class="layui-form-label mid"><span class="required" id="img_url_required">*</span>上传图片:</label>
|
||||
<div class="layui-input-inline mid">
|
||||
<div class="upload-img-block">
|
||||
<div class="upload-img-box">
|
||||
<div class="upload-default" id="imgUploadGoods">
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>点击上传</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
|
||||
</div>
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
<input type="hidden" name="img_url" lay-verify="img_url">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row mid">
|
||||
<button class="layui-btn" lay-submit lay-filter="add_signature">确定</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closeSignature()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
Reference in New Issue
Block a user