js中时间戳转换为时间格式

xiaoxiao2021-02-28  53

//我审批的     $(function(){        // $('#mypower').click(function(){            // alert('kk')             $("#mysend").removeClass("approve_BA_1red");//清空liCSS属性               $(this).addClass('approve_BA_1red');//选中li添加属性               $(".approve_BA_Y2_1").show();               $(".approve_BA_Y2_2").hide();             var s_id = localStorage.getItem("s_id");             var time = getTime();             var sign = getSign([s_id,time]);             $.ajax({             type: "POST",             url: api_url+"power/mypower",             data: {                 s_id:s_id,                 time:time,                 sign:sign,             },             dataType: "json",             success: function(data){                     if(data.code == 1){                     //console.log(data.message);                     console.log(data.data);                     //              填充内容                 var html = '';                 var con = data['data'];                 for(var i=0;i<con.length;i++){                     html += '<div class="approve_BA_Y2_left">';                     html += '<div class="approve_BA_left_1"  >';                     html += '<div class="approve_L1"><img src="';                     html += con[i]['sp_image'];                     html += '"/></div>';                     html+=' <div class="approve_L2" >';                     html+=' <p>';                     if(con[i]['sp_sptid']==1){                         html+="入库出错";                     }                     if(con[i]['sp_sptid']==2){                        html+="商品内耗";                     }                     if(con[i]['sp_sptid']==3){                         html+="买手拒单";                     }                     if(con[i]['sp_sptid']==4){                         html+="其他";                     }                     //html+=con[i]['sp_sptid'];                     html+='</p>';                     html+='<p>订单编号:<span>';                     html+=con[i]['o_second_order_id'];                     html+='</span></p>';                     html+='<p>';                     if(con[i]['sp_status']==0){                         html+="未审批";                     }                     if(con[i]['sp_status']==1){                         html+="已同意";                     }                     if(con[i]['sp_status']==2){                         html+="未同意";                     }                     html+='</p>';                     html+='</div>';                     html+='<div class="approve_L3" >';                     html+='<p>';                     var date = new Date(con[i]['sp_create']*1000);                     Y = date.getFullYear() + '-';                     M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';                     D = date.getDate() + ' ';                     h = date.getHours() + ':';                     m = date.getMinutes() + ':';                     s = date.getSeconds();                      html+="提交时间";                     html+=Y+M+D;                     html+='</p>';                     if(con[i]['sp_modified']==null){                         html+="";                     }else{                         html+='<p>';                         var date = new Date(con[i]['sp_modified']*1000);                         Y = date.getFullYear() + '-';                         M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';                         D = date.getDate() + ' ';                         h = date.getHours() + ':';                         m = date.getMinutes() + ':';                         s = date.getSeconds();                          html+="审批时间";                         html+=Y+M+D;                         html+='</p>';                     }                                  if(con[i]['sp_status']==0){                         html+='<div style="width:1.3rem;height:0.4rem;margin-left:1.5rem;margin-top:0.15rem;">';                         html+='<button id="argree" style="margin-right:0.2rem;" οnclick="argree(';                         html+= con[i]['sp_id'];                         html+= ')">同意</button>';                         html+='<button id="argree" οnclick="forbid(';                         html+= con[i]['sp_id'];                         html+= ')">拒绝</button>';                         html+='</div>';                     }                                         html += '</div></div>';                 }                 $("#approve_BA_Y2_1").html(html);                 }else{                     mui.toast(data.message);                                     }             }         });           //})     }) //同意审批 function argree(sp_id) {    //alert(sp_id);         var s_id = localStorage.getItem("s_id");         $.ajax({             type: "POST",             url: api_url+"power/passpower",             data: {                 sp_id:sp_id,                 s_id:s_id,             },             dataType: "json",             success: function(data){                 //alert(data);                 if(data.code == 1){                     mui.toast(data.message);                         history.go(0)                                                               }else{                     mui.toast(data.message);                                     }             }         });     }          //拒绝审批 function forbid(sp_id) {    // alert(sp_id);         var s_id = localStorage.getItem("s_id");         $.ajax({             type: "POST",             url: api_url+"power/forbidpower",             data: {                 sp_id:sp_id,                 s_id:s_id,             },             dataType: "json",             success: function(data){                 //alert(data);                 if(data.code == 1){                     mui.toast(data.message);                      history.go(0)                  }else{                     mui.toast(data.message);                                     }             }         }); }          //我发起的     $(function(){         $('#mysend').click(function(){                 // alert('yy')                 $("#mypower").removeClass("approve_BA_1red");//清空liCSS属性                   $(this).addClass('approve_BA_1red');//选中li添加属性                   $(".approve_BA_Y2_1").hide();                   $(".approve_BA_Y2_2").show();             var s_id = localStorage.getItem("s_id");             var time = getTime();             var sign = getSign([s_id,time]);                  $.ajax({             type: "POST",             url: api_url+"power/mysend",             data: {                 s_id:s_id,                 time:time,                 sign:sign,             },             dataType: "json",             success: function(data){                 if(data.code == 1){                 console.log(data.data);                     //填充内容                 var html = '';                 var con = data['data'];                 for(var i=0;i<con.length;i++){                     html += '<div class="approve_BA_Y2_left">';                     html += '<div class="approve_BA_left_1">';                     html += '<div class="approve_L1"><img src="';                     html += con[i]['sp_image'];                     html += '"/></div>';                     html+=' <div class="approve_L2">';                     html+=' <p>';                     if(con[i]['sp_sptid']==1){                         html+="入库出错";                     }                     if(con[i]['sp_sptid']==2){                         html+="商品内耗";                     }                     if(con[i]['sp_sptid']==3){                        html+="买手拒单";                     }                     if(con[i]['sp_sptid']==4){                         html+="其他";                     }                     //html+=con[i]['sp_sptid'];                     html+='</p>';                     html+='<p>订单编号:<span>';                     html+=con[i]['o_second_order_id'];                     html+='</span></p>';                     html+='<p>';                     if(con[i]['sp_status']==0){                         html+="未审批";                     }                     if(con[i]['sp_status']==1){                         html+="已同意";                     }                     if(con[i]['sp_status']==2){                         html+="未同意";                     }                     //html+=con[i]['sp_status'];                     html+='</p>';                     html+='</div>';                     html+='<div class="approve_L3">';                     html+='<p>';                     var date = new Date(con[i]['sp_create']*1000);                     Y = date.getFullYear() + '-';                     M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';                     D = date.getDate() + ' ';                     h = date.getHours() + ':';                     m = date.getMinutes() + ':';                     s = date.getSeconds();                      html+="提交时间";                     html+=Y+M+D;                     html+='</p>';                     if(con[i]['sp_modified']==null){                         html+="";                     }else{                         html+='<p>';                         var date = new Date(con[i]['sp_modified']*1000);                         Y = date.getFullYear() + '-';                         M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';                         D = date.getDate() + ' ';                         h = date.getHours() + ':';                         m = date.getMinutes() + ':';                         s = date.getSeconds();                          html+="审批时间";                         html+=Y+M+D;                         html+='</p>';                     }                                          //html+=con[i]['sp_create'];                     html+='</div>';                     html += '</div></div>';                 }                 $("#approve_BA_Y2_2").html(html);                 }else{                     mui.toast(data.message);                                     }             }         });                              })     })
转载请注明原文地址: https://www.6miu.com/read-2625854.html

最新回复(0)