| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- {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" 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" 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/addDeliver"),
- data: data.field,
- dataType: 'JSON',
- type: 'POST',
- success: function(res) {
- repeat_flag = false;
- if (res.code == 0) {
- layer.confirm('添加成功', {
- title:'操作提示',
- btn: ['返回列表', '继续添加'],
- closeBtn: 0,
- yes: function(){
- 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")
- }
- },
- btn2: function () {
- if($('input[name="store_id"]').val() > 0){
- location.href = ns.url("shop/store/addDeliver",{'store_id':$('input[name="store_id"]').val()})
- }else{
- location.href = ns.url("shop/local/addDeliver")
- }
- }
- });
- } else {
- layer.msg(res.message);
- }
- }
- });
- });
- /**
- * 表单验证
- */
- form.verify({
- deliverName: function(value){
- if (value == '') {
- return '配送员名称不能为空!';
- }
- },
- deliverMobile: function (value) {
- if (value == '') {
- return '手机号不能为空!';
- }
- if (!ns.parse_mobile(value)) {
- return '请输入合法的手机号!'
- }
- }
- });
- });
- 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}
|