util.js 785 Bytes
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
import {AuditStatusEnum} from "@/utils/constants";
import i18n from '@/i18n'
export const getStatusName = (row) => {
    //判断价格是否过期
    let validateStartDate = row.validateStartDate;
    let validateEndDate = row.validateEndDate;
    let notSetPrice = false;
    let nowDate = new Date().getTime();
    if(validateStartDate && validateStartDate > nowDate) {
        notSetPrice = true;
    }
    if(validateEndDate && validateEndDate < nowDate) {
        notSetPrice = true;
    }
    let setPriceText = notSetPrice ? '(' + i18n.t('已过期') + ')' : '';
    if(row.blacklist) return i18n.t('黑名单') //  + setPriceText;
    if(row.auditStatus === AuditStatusEnum.PASS) return i18n.t('已上架') // + setPriceText;
    return i18n.t('已下架') + setPriceText;
}