123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- var formatNumber = function(n){
- n = n.toString()
- return n[1] ? n : '0' + n
- }
- var formatTime = function (number, format) {
- var formateArr = ['Y', 'M', 'D', 'h', 'm', 's'];
- var returnArr = [];
- var date = getDate(number);
- returnArr.push(date.getFullYear());
- returnArr.push(formatNumber(date.getMonth() + 1));
- returnArr.push(formatNumber(date.getDate()));
- returnArr.push(formatNumber(date.getHours()));
- returnArr.push(formatNumber(date.getMinutes()));
- returnArr.push(formatNumber(date.getSeconds()));
- returnArr.forEach(function(item,index) {
- format = format.replace(formateArr[index], item);
- })
- return format;
- }
- var nodeTime = function(n) {
- var n_year = getDate(n).getFullYear();
- var today_year = getDate().getFullYear();
- if(n_year < today_year){
- return formatTime(n, 'Y-M-D h:m')
- }else{
- return formatTime(n, 'M-D h:m')
- }
- }
- var wantDrinkNum = function(n) {
- if(n >= 99) {
- return '99+'
- }else{
- return n
- }
- }
- var orderStatus = function(stu) {
- switch (stu) {
- case 1:
- return "待支付";
- break;
- case 2:
- return "进行中";
- break;
- case 3:
- return "取消支付";
- break;
- case 10:
- return "已完成";
- break;
- case 11:
- return "申请退款";
- break;
- case 12:
- return "部分退款";
- break;
- case 13:
- return "全额退款";
- break;
- case 99:
- return "订单异常";
- break;
- }
- }
- var unitTypeText = function(stu) {
- switch (stu) {
- case 0:
- return "天";
- break;
- case 1:
- return "个月";
- break;
- case 3:
- return "升";
- break;
- }
- }
- var blindBoxStatus = function(stu) {
- switch (stu) {
- case 0:
- return "已完成";
- break;
- case 1:
- return "待开放";
- break;
- case 2:
- return "认购中";
- break;
- case 3:
- return "待分配";
- break;
- case 4:
- return "待发货";
- break;
- case 5:
- return "已发货";
- break;
- case 11:
- return "申请退款";
- break;
- case 12:
- return "已退款";
- break;
- }
- }
- module.exports = {
- formatTime: formatTime,
- wantDrinkNum: wantDrinkNum,
- orderStatus: orderStatus,
- unitTypeText: unitTypeText,
- blindBoxStatus: blindBoxStatus,
- nodeTime: nodeTime
- };
|