admin
2025-08-20 f318c9c7c127b00f353bf45f273096d1dc4b424f
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
<!DOCTYPE html>
<html>
 
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>修改下单任务</title>
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css"/>
    <style>
        body {
            padding: 10px;
        }
 
        #sure {
            visibility: hidden;
        }
 
        .layui-form-label {
            width: 150px;
        }
 
        .layui-input-block {
            margin-left: 180px;
            max-width: 400px;
        }
    </style>
</head>
 
<body>
 
<form class="layui-form" lay-filter="edit">
    <input type="hidden" name="id"/>
    <div class="layui-form-item">
        <label class="layui-form-label">口令内容:</label>
        <div class="layui-input-block">
            <textarea  name="keywordContent" rows="5" required lay-verify="required" placeholder="口令内容"
                       autocomplete="off" class="layui-textarea"></textarea>
        </div>
    </div>
 
    <div class="layui-form-item">
        <label class="layui-form-label">商品来源:</label>
        <div class="layui-input-block">
            <select name="productSource" required lay-verify="required">
                <option value="">请选择商品来源</option>
                <option value="1">抖音</option>
                <option value="2">快手</option>
            </select>
        </div>
    </div>
 
    <div class="layui-form-item">
        <label class="layui-form-label">商品名称:</label>
        <div class="layui-input-block">
            <textarea name="productName" rows="3" required lay-verify="required" placeholder="商品名称" autocomplete="off"
                      class="layui-textarea"></textarea>
        </div>
    </div>
 
    <div class="layui-form-item">
        <label class="layui-form-label">店铺名称:</label>
        <div class="layui-input-block">
            <input type="text" name="shopName" placeholder="店铺名称" autocomplete="off" class="layui-input">
        </div>
    </div>
 
    <div class="layui-form-item">
        <label class="layui-form-label">所需下单数量:</label>
        <div class="layui-input-block">
            <input type="number" name="requiredOrderCount" required lay-verify="required|number" min="1"
                   placeholder="所需下单数量" autocomplete="off" class="layui-input">
        </div>
    </div>
 
    <div class="layui-form-item">
        <label class="layui-form-label">收货周期(分钟):</label>
        <div class="layui-input-block">
            <input type="number" name="receiveCycleMinutes" required lay-verify="required|number" min="1"
                   placeholder="收货周期(分钟)" autocomplete="off" class="layui-input">
        </div>
    </div>
 
    <div class="layui-form-item">
        <label class="layui-form-label">下单开始时间:</label>
        <div class="layui-input-block">
            <input type="text" name="orderStartTime" id="orderStartTime" required lay-verify="required"
                   placeholder="下单开始时间" autocomplete="off" class="layui-input">
        </div>
    </div>
 
    <div class="layui-form-item">
        <label class="layui-form-label">下单结束时间:</label>
        <div class="layui-input-block">
            <input type="text" name="orderEndTime" id="orderEndTime" required lay-verify="required"
                   placeholder="下单结束时间" autocomplete="off" class="layui-input">
        </div>
    </div>
 
    <div class="layui-input-block">
        <button class="layui-btn layui-btn-normal" lay-submit lay-filter="sure" id="sure">确定</button>
    </div>
</form>
<script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/http_api.js"></script>
<script>
    var listener;
 
    function submit(callback) {
        //暂存回调方法
        listener = callback;
        //表单提交按钮
        $("#sure").click();
    }
 
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form,
            layer = layui.layer,
            laydate = layui.laydate;
 
        //自定义验证规则
        form.verify({
            num: [/^\d+$/, "必须为正整数"],
            money: [/^\d+(\.\d{1,2})?$/, "金额最多保留2位小数"]
        });
 
        // 日期控件初始化
        laydate.render({
            elem: '#orderStartTime',
            type: 'datetime',
            theme: '#448aff'
        });
 
        laydate.render({
            elem: '#orderEndTime',
            type: 'datetime',
            theme: '#448aff'
        });
 
        var id = http_util.getQueryString("id");
        // 获取值
        $.post("/admin/api/ordertask/js2/get", {
            "id": id
        }, function (response) {
            if (response.code == 0) {
                form.val("edit", response.data);
            } else {
                layer.msg(response.msg);
            }
        }, 'json').fail(function (jqXHR, textStatus, errorThrown) {
            layer.msg("网络请求失败");
        });
 
        //监听提交
        form.on('submit(sure)', function (data) {
            listener(data.field);
            return false;
        });
    });
</script>
</body>
 
</html>