js中時間戳轉換為時間格式
阿新 • • 發佈:2018-11-01
//我審批的
$(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;" onclick="argree(';
html+= con[i]['sp_id'];
html+= ')">同意</button>';
html+='<button id="argree" onclick="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);
}
}
});
})
})
$(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;" onclick="argree(';
html+= con[i]['sp_id'];
html+= ')">同意</button>';
html+='<button id="argree" onclick="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);
}
}
});
})
})