admin
10 天以前 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
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <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="/admin/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="/admin/css/admin.css"/>
    <script src="js/http_api.js"></script>
    <style>
        .layui-table-cell {
            height: 50px;
            white-space: normal;
            max-height: 50px;
        }
 
        /* 添加横向滚动样式 */
        .scroll-x {
            overflow: hidden !important;
            overflow-x: auto !important;
            white-space: nowrap;
            outline: none;
        }
    </style>
</head>
<body>
<div class="page-content-wrap">
 
    <div class="scroll-x">
        <table class="layui-table" lay-even lay-skin="nob" id="clientsTable" style="height: 100%"></table>
    </div>
</div>
 
<!-- 修改预计评价时间弹窗 -->
<div id="updateExpectedReviewTime" style="display: none; padding: 20px;">
    <form class="layui-form" action="">
        <input type="hidden" name="id" id="detailId">
        <div class="layui-form-item">
            <label class="layui-form-label">预计评价时间</label>
            <div class="layui-input-block">
                <input type="text" name="expectedReviewTime" id="expectedReviewTime" placeholder="请选择预计评价时间" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="updateExpectedReviewTime">确定</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
 
<script src="/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="/admin/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['table', 'layer', 'laydate'], function () {
        var table = layui.table;
        var layer = layui.layer;
        var laydate = layui.laydate;
        var urlParams = new URLSearchParams(window.location.search);
        var taskId = urlParams.get('taskId');
        
        // 渲染表格
        var tableIns = table.render({
            elem: '#clientsTable',
            url: '/admin/api/ordertask/js2/assignedClients',
            where: {
                taskId: taskId
            },
            parseData: function(res) {
                return {
                    "code": res.code,
                    "msg": res.msg,
                    "count": res.data.count,
                    "data": res.data.list
                }
            },
            page: true,
            cols: [[
                {field: 'clientId', title: '客户端ID', width: 100},
                {field: 'orderNo', title: '订单号', width: 150},
                {field: 'productName', title: '商品名称', width: 150},
                {field: 'shopName', title: '店铺名称', width: 120},
                {field: 'couponCode', title: '券码', width: 120},
                {
                    field: 'executionStatus', title: '执行状态', width: 120, templet: function (d) {
                        switch (d.executionStatus) {
                            case 0: return '<span style="color: #999">未下单</span>';
                            case 1: return '<span style="color: #009900">已下单</span>';
                            case -1: return '<span style="color: #ff0000">下单失败</span>';
                            case 2: return '<span style="color: #009900">确认收货成功</span>';
                            case -2: return '<span style="color: #ff0000">确认收货失败</span>';
                            case 3: return '<span style="color: #009900">评价成功</span>';
                            case -3: return '<span style="color: #ff0000">评价失败</span>';
                            default: return '未知状态';
                        }
                    }
                },
                {field: 'statusDescription', title: '状态说明', width: 150},
                {field: 'orderTime', title: '下单时间', width: 160},
                {field: 'receiveTime', title: '收货时间', width: 160},
                {field: 'expectedReviewTime', title: '预估评价时间', width: 160},
                {field: 'reviewTime', title: '评价时间', width: 160},
 
                {field: 'createTime', title: '创建时间', width: 160},
                {field: 'updateTime', title: '更新时间', width: 160},
                {
                    title: '操作', width: 120, align: 'center', fixed: "right", templet: function (d) {
                        return "<a href='javascript:void(0)' class='layui-table-link' onclick=\"updateExpectedReviewTime('" + d.id + "')\">设置预估时间</a>";
                    }
                },
            ]]
        });
        
        // 修改预计评价时间
        window.updateExpectedReviewTime = function(id, expectedReviewTime) {
            // 设置表单值
            $("#detailId").val(id);
            $("#expectedReviewTime").val(expectedReviewTime);
            
            // 弹出修改窗口
            layer.open({
                type: 1,
                title: "修改预计评价时间",
                content: $("#updateExpectedReviewTime"),
                area: ['500px', '300px'],
                end: function() {
                    $("#updateExpectedReviewTime").css("display", "none");
                }
            });
            
            // 初始化日期控件
            laydate.render({
                elem: '#expectedReviewTime',
                type: 'datetime',
                theme: '#448aff',
                value: expectedReviewTime
            });
        };
        
        // 监听表单提交
        layui.form.on('submit(updateExpectedReviewTime)', function(data) {
            $.post("/admin/api/ordertask/js2/updateExpectedReviewTime", data.field, function(response) {
                if (response.code == 0) {
                    layer.msg("修改成功");
                    layer.closeAll('page');
                    // 重新加载表格
                    tableIns.reload();
                } else {
                    layer.msg(response.msg);
                }
            }, 'json').fail(function(jqXHR, textStatus, errorThrown) {
                layer.msg("网络请求失败");
            });
            
            return false;
        });
    });
</script>
</body>
</html>