// 保留两位小数，自动补充零
function filterToFixed(value) {
	var value = Math.round(parseFloat(value) * 100) / 100;
	var xsd = value.toString().split(".");
	if (xsd.length == 1) {
		value = value.toString() + ".00";
		return value;
	}
	if (xsd.length > 1) {
		if (xsd[1].length < 2) {
			value = value.toString() + "0";
		}
		return value;
	}
}

//  计算时间戳
export function timeStamp(obj, interval) {
	//  根据订单状态获取需要计算倒计时的对应时间字段
	let orderMap = {
		0: 'createTime',
		1: 'authTime',
		// 2: 'sendTime',
		3: 'outTime',
		// 3: 'receiveTime'
	}
	let time = obj[orderMap[obj.orderStatus]]
	let sDate = new Date(time).getTime()
	let eDate = interval*60*1000
	return ((sDate + eDate) - new Date().getTime())/1000
}

// 保留两位小数，自动补充零
function dileveryStatus(value) {
	let dileveryList = ['下单', '揽件', '运输中', '派件中', '签收', '退回', '拒签']
	return dileveryList[val]
}
