114 lines
4.2 KiB
HTML
114 lines
4.2 KiB
HTML
{extend name="base"/}
|
|
{block name="resources"}
|
|
<style>
|
|
.design-sketch div{display: inline-block;border: 1px solid #ccc;padding: 10px;margin: 8px;border-radius: 2px;color: #555;white-space: nowrap;user-select: none;background-color: #fff;line-height: 1;}
|
|
.design-sketch div i{position: absolute;top: -10px;right: -10px;display: none;width: 20px;height: 20px;border-radius: 10px;background-color: rgba(0, 0, 0, .5);color: #FFFFFF;text-align: center;line-height: 20px;z-index: 99;}
|
|
.form-row{margin-top: 0;margin-left: 220px;}
|
|
.express-sheet-rule .form-row{margin-left: 200px;}
|
|
</style>
|
|
{/block}
|
|
{block name="main"}
|
|
<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">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label"><span class="required">*</span>配送员名称:</label>
|
|
<div class="layui-input-inline">
|
|
<input type="text" name="deliver_name" lay-verify="required|deliverName" value="{$deliver_info.deliver_name}" class="layui-input len-long">
|
|
<input type="hidden" name="deliver_id" lay-verify="required|deliverName" value="{$deliver_id}" class="layui-input len-long">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label"><span class="required">*</span>配送员手机号:</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" name="deliver_mobile" lay-verify="required|deliverMobile" value="{$deliver_info.deliver_mobile}" class="layui-input len-long">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<input type="hidden" value="{$store_id ?? 0}" name="store_id">
|
|
<div class="form-row">
|
|
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
|
<button type="reset" class="layui-btn layui-btn-primary" onclick="back()">返回</button>
|
|
</div>
|
|
|
|
</div>
|
|
{/block}
|
|
{block name="script"}
|
|
<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("shop/local/editDeliver"),
|
|
data: data.field,
|
|
dataType: 'JSON',
|
|
type: 'POST',
|
|
success: function(res) {
|
|
repeat_flag = false;
|
|
layer.msg(res.message);
|
|
if (res.code == 0) {
|
|
if($('input[name="store_id"]').val() > 0){
|
|
location.href = ns.url("shop/store/deliverLists",{'store_id':$('input[name="store_id"]').val()})
|
|
}else{
|
|
location.href = ns.url("shop/local/deliverLists")
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
/**
|
|
* 表单验证
|
|
*/
|
|
form.verify({
|
|
deliverName: function(value){
|
|
if (value == '') {
|
|
return '配送员名称不能为空!';
|
|
}
|
|
},
|
|
deliverMobile: function (value) {
|
|
if (value == '') {
|
|
return '手机号不能为空!';
|
|
}
|
|
if (!isPoneAvailable(value)) {
|
|
return '请输入合法的手机号!'
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
/**
|
|
* 验证手机号正则
|
|
*/
|
|
function isPoneAvailable(poneInput) {
|
|
var myreg=/^1(3|4|5|6|7|8|9)\d{9}$/;
|
|
if (!myreg.test(poneInput)) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
function back(){
|
|
if($('input[name="store_id"]').val() > 0){
|
|
location.href = ns.url("shop/store/deliverLists",{'store_id':$('input[name="store_id"]').val()})
|
|
}else{
|
|
location.href = ns.url("shop/local/deliverLists");
|
|
}
|
|
}
|
|
</script>
|
|
{/block} |