YYC
2023-07-10 b642a88b35271f37e411a603c29a57875111730c
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
var url = null;
var recordList = null;
var dateTime;
//申请记录
var data = {
    "interfaceId": "5702",
    "outId": "10702",
    "reqDateTime": new Date(),
    "tokenAuth": "",
    "data": {
        "userName": "",
    }
};
 
function init() {
    var user = JSON.parse(localStorage.getItem('user'));
    url = user.url + "/api-phone/v35/gateway";
    data.tokenAuth = user.tokenAuth;
    data.data.userName = user.username;
    console.log(JSON.stringify(data.data),"work-record")
    dateTime = getDate(new Date());
    getRecordList();
}
//日期格式化yyyy-MM-dd HH:mm
function getDate(date) {
    var year = date.getFullYear();
    var month, day,hour,minute;
    month = date.getMonth() + 1;
    if (month > 0 && month <= 9) {
        month = "0" + month;
    }
    day = date.getDate()
    if (day > 0 && day <= 9) {
        day = "0" + day
    }
    hour = date.getHours();
    minute = date.getMinutes();
    return year + "-" + month + "-" + day + " "+ hour + ":" + minute
}
 
//获取申请记录列表
function getRecordList() {
    mui.ajax(url, {
        type: "POST",
        dataType: "json",
        crossDomain: true,
        contentType: "application/json;charset=utf-8",
        data: JSON.stringify(data),
        success: function(result) {
            if (result.code == "0000") {
                recordList = result.data;
                // console.log(JSON.stringify(recordList))
                renderRecordList();
            } else {
                renderRecordList();
                mui.toast(result.msg, '提示', ["确定"], function() {}, "div");
            }
        },
        error: function() {
            renderRecordList();
            mui.alert('系统繁忙,请重新登录尝试!', '提示', ["确定"], function() {}, "div");
        }
    })
}
 
function renderRecordList() {
    var html = '';
    if (recordList && recordList.length > 0) {
        $.each(recordList, function(index, item) {
            html += '<li><div class="con conInfo" info = "' + item.info + '"><span class="status">';
            //已审核
            if (item.status == '10') {
                html += '<img src="images/icons/g-i29.png" alt=""></span>'
            } else if (item.status == '20') { // 待审核
                html += '<img src="images/icons/g-i28.png" alt=""></span>'
            }
            html += '<div class="title"><b></b></div><div class="box"><ul class="gd-list">';
            html += '<li><a href="" class="con"style="background-image: url(images/icons/a-bg12.png);">';
            html += '<div class="tit">业务类型:</div><div class="name">' + item.type + '</div></a></li>';
            html += '<li><a href="" class="con"style="background-image: url(images/icons/a-bg13.png);">';
            html += '<div class="tit">关联仓库:</div><div class="name">' + (item.depotName == null ? "--" : item.depotName) + '</div></a></li></ul>';
            html += '<div class="time"><p>有效开始时间: <span>' + item.startTime + '</span></p><p>有效结束时间: <span>' +
                item.endTime + '</span></p></div>';
        })
    } else {
        html += '<li><div class="con conInfo" info = "暂无申请记录"><span class="status">';
        //已审核
        html += '<img src="images/icons/g-i29.png" alt=""></span>'
        html += '<div class="title"><b>暂无申请记录</b></div><div class="box"><ul class="gd-list">';
        html += '<li><a href="" class="con"style="background-image: url(images/icons/a-bg12.png);">';
        html += '<div class="tit">业务类型:</div><div class="name">--</div></a></li>';
        html += '<li><a href="" class="con"style="background-image: url(images/icons/a-bg13.png);">';
        html += '<div class="tit">关联仓库:</div><div class="name">--</div></a></li></ul>';
        html += '<div class="time"><p>有效开始时间: <span>' + dateTime + '</span></p><p>有效结束时间: <span>' + dateTime + '</span></p></div>';
    }
    $("#handleList").html(html);
}
 
//查看信息
mui(".mui-scroll").on("tap", ".wp ul li .conInfo", function() {
    var info = this.getAttribute("info");
    // mui.alert(info, '工单内容', ["确定"], function() {}, "div");
    $("#textareaPop").val(info)
    $('#m-pop').css('display', 'flex');
    console.log("查看信息")
})
 
//关闭弹窗
function closePop() {
    $("#m-pop").css('display', 'none');
}
 
mui('.mui-scroll-wrapper').scroll({
    indicators: true, //是否显示滚动条
    deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏
    bounce: false, //是否启用回弹
    deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
});