订单支付的效果图
click(e) { //点击切换tarbs并调用数据
this.current = e;
if (this.current != 0) {
this.getOrderList(this.current);
}
},
getOrderList(status) { //订单列表
let t = this;
if (status == 1) {
this.status = `0,${status}`;
} else {
this.status = status;
}
t.$u.api.orderList({
status: this.status,
page: t.page,
list_rows: t.list_rows
}).then(res => {
let times = new Date().getTime() / 1000; //当前时间
res.data.forEach((item, index) => {
item.daojishi = item.pay_end_time - times; //时间差 = 截止时间-当前时间
})
t.watherd = res.data;
if (t.watherd != 0) { // 是否展示空白页
t.is_content = true
} else {
t.is_content = false
}
this.cuntDown();
})
},
cuntDown() { // 计算时间差
var isFind = false; //是否开启
for (let i = 0; i < this.watherd.length; ++i) {
let item = this.watherd[i];
if (item.status_text == '待支付') {
item.daojishi--;
item.pay_end_time = (parseInt(item.daojishi / 60) < 10 ? ("0" + parseInt(item.daojishi / 60)) :
parseInt(item.daojishi / 60)) + ":" + (parseInt(item.daojishi % 60) < 10 ? ("0" + parseInt(
item.daojishi % 60)) : parseInt(item.daojishi % 60));
isFind = true;
if (parseInt(item.daojishi) <= 0) {
item.pay_end_time = "0:0"
}
}
}
if (isFind) {
setTimeout(this.cuntDown, 1000);
}
},
particulars(ite)