import {SalesType} from "./goods"
export const OrderType = {
    ORDER: 1,
    DELIVERY: 2,
    TRANSFER: 3,
}

export const OrderTypeObj = {
    [OrderType.ORDER]: { label: "商品订单", listApi: "getOrderList", detailApi: "getOrderDetail", refundListApi: "getOrderRefundList" },
    [OrderType.DELIVERY]: { label: "提货订单", listApi: "getDeliveryList", detailApi: "getDeliveryDetail", refundListApi: "getDeliveryRefundList" },
    [OrderType.TRANSFER]: { label: "转让单", listApi: "getTransferOrderList", detailApi: "getDeliveryDetail" },
}


export const OrderStatus = {
    SUCCESS: 1,
    CLOSE: 2,
    UN_REFUND: 4,
    REFUND: 5,
    PAYING: 6,
    UN_PAY: 7,
    REFUND_CANCEL: 8,
    REFUND_FAIL: 9,
    REFUND_CHAIN_FAIL: 11,
    REFUNDING: 12,
    REFUND_ERROR: 13,
    END: 14
}

export const OrderStatusObj = {
    [OrderStatus.SUCCESS]: { label: "已完成", color: "#666666", icon: "icon-order-success" },
    [OrderStatus.CLOSE]: { label: "已取消", color: "#666666", icon: "icon-order-error" },
    [OrderStatus.UN_REFUND]: { label: "待退款", color: "#FA9F37", icon: "icon-order-wait" },
    [OrderStatus.REFUND]: { label: "已退款", color: "#666666", icon: "icon-order-success" },
    [OrderStatus.PAYING]: { label: "支付中", color: "#FA9F37", icon: "icon-order-wait" },
    [OrderStatus.UN_PAY]: { label: "待付款", color: "#FA9F37", icon: "icon-order-wait" },
    [OrderStatus.REFUND_CANCEL]: { label: "已完成", color: "#666666", icon: "icon-order-success" },//撤销退款
    [OrderStatus.REFUND_FAIL]: { label: "已完成", color: "#666666", icon: "icon-order-success" },//退款驳回
    [OrderStatus.REFUND_CHAIN_FAIL]: { label: "链上退款失败", color: "#666666", icon: "icon-order-error" },
    [OrderStatus.REFUNDING]: { label: "退款中", color: "#666666", icon: "icon-order-wait" },
    [OrderStatus.REFUND_ERROR]: { label: "退款失败", color: "#666666", icon: "icon-order-error" },
    [OrderStatus.END]: { label: "已完成", color: "#666666", icon: "icon-order-success" },
}

export const DeliveryStatus = {
    UN_SHIP: 0,
    SHIP: 1,
    RECEIVE: 2,
    CANCEL: 3,
    UN_REFUND: 4,
    REFUND: 5,
    SUCCESS: 6,
    REFUND_FAIL: 7,
    REFUND_EXPRESS: 8
}

export const DeliveryStatusObj = {
    [DeliveryStatus.UN_SHIP]: { label: "待发货", color: "#DD2E41", icon: "icon-order-wait" },
    [DeliveryStatus.SHIP]: { label: "待收货", color: "#DD2E41", icon: "icon-order-wait" },
    [DeliveryStatus.RECEIVE]: { label: "已收货", color: "#666666", icon: "icon-order-success" },
    [DeliveryStatus.CANCEL]: { label: "已撤销", color: "#666666", icon: "icon-order-error" },
    [DeliveryStatus.UN_REFUND]: { label: "待退货", color: "#DD2E41", icon: "icon-order-wait" },
    [DeliveryStatus.REFUND]: { label: "已退货", color: "#666666", icon: "icon-order-success" },
    [DeliveryStatus.SUCCESS]: { label: "已完成", color: "#666666", icon: "icon-order-success" },
    [DeliveryStatus.REFUND_FAIL]: { label: "已完成", color: "#666666", icon: "icon-order-success" },//退货驳回
    [DeliveryStatus.REFUND_EXPRESS]: { label: "待退货", color: "#DD2E41", icon: "icon-order-wait" },//退货待签收
}

export const TransferOrderStatus = {
    UN_PAY: 0,
    SUCCESS: 1,
    TIMEOUT: 2,
    CANCEL: 3,
}

export const TransferOrderStatusObj = {
    [TransferOrderStatus.UN_PAY]: {
        label: "待付款",
        color: "#DD2E41"
    },
    [TransferOrderStatus.SUCCESS]: {
        label: "已完成",
        color: "#140603"
    },
    [TransferOrderStatus.TIMEOUT]: {
        label: "已超时",
        color: "#AEAEAE"
    },
    [TransferOrderStatus.CANCEL]: {
        label: "已取消",
        color: "#AEAEAE"
    },
}

export const CommentStatus = {
    NO: 0,
    YES: 1,
    ADD: 2
}

export const CommentStatusObj = {
    [CommentStatus.NO]: { label: "未评价", api: "releaseComment" },
    [CommentStatus.YES]: { label: "已评价", api: "addComment" },
    [CommentStatus.ADD]: { label: "已追评" },
}

export const RefundType = {
    MONEY: 1,
    GOODS: 2,
    CHANGE: 3
}

export const RefundTypeObj = {
    [RefundType.MONEY]: {
        label: "退款",
        title: "仅退款",
        desc: "没收到货，或与卖家协商不用退货只退款",
        icon: "icon-refund-money",
        api: "applyOrderRefund",
        detailApi: "getOrderRefundDetail"
    },
    [RefundType.GOODS]: {
        label: "退货",
        title: "退货",
        desc: "已收到货，需要退还收到的货物",
        icon: "icon-refund-goods",
        api: "applyDeliveryRefund",
        detailApi: "getDeliveryRefundDetail"
    },
    [RefundType.CHANGE]: {
        label: "换货",
        title: "换货",
        desc: "商品存在问题，联系卖家协商换货",
        icon: "icon-refund-change"
    },
}

export const RefundStatus = {
    APPLY: 1,
    REVIEW_SUCCESS: 2,
    REVIEW_FAIL: 3,
    CANCEL: 4,
    SUCCESS: 5
}

export const RefundStatusObj = {
    [RefundStatus.APPLY]: { label: "待审核", color: "#DD2E41" },
    [RefundStatus.REVIEW_SUCCESS]: { label: "审核通过", color: "#666666" },
    [RefundStatus.REVIEW_FAIL]: { label: "审核驳回", color: "#DD2E41" },
    [RefundStatus.CANCEL]: { label: "已撤回", color: "#666666" },
    [RefundStatus.SUCCESS]: { label: "已退款", color: "#666666" },
}

export const DeliveryRefundStatus = {
    APPLY: 1,
    REVIEW_SUCCESS: 2,
    EXPRESS: 3,
    SHOP_REFUND: 4,
    SUCCESS: 5,
    REVIEW_FAIL: 6,
    CANCEL: 7
}

export const DeliveryRefundStatusObj = {
    [DeliveryRefundStatus.APPLY]: { label: "待审核", color: "#DD2E41" },
    [DeliveryRefundStatus.REVIEW_SUCCESS]: { label: "审核通过", color: "#666666" },
    [DeliveryRefundStatus.EXPRESS]: { label: "已寄回", color: "#DD2E41" },
    [DeliveryRefundStatus.SHOP_REFUND]: { label: "已退款", color: "#666666" },
    [DeliveryRefundStatus.SUCCESS]: { label: "已退货", color: "#666666" },
    [DeliveryRefundStatus.REVIEW_FAIL]: { label: "审核驳回", color: "#DD2E41" },
    [DeliveryRefundStatus.CANCEL]: { label: "已撤回", color: "#666666" },
}

export const RefundReasonType = {
    DISSATISFIED: 0,
    QUALITY: 1,
    DAMAGE: 2,
    PRICE: 3,
    DESCRIBE: 4,
    OTHER: 5
}

export const RefundReasonTypeLabel = {
    [RefundReasonType.DISSATISFIED]: "不合适 / 不满意",
    [RefundReasonType.QUALITY]: "质量问题",
    [RefundReasonType.DAMAGE]: "商品损坏",
    [RefundReasonType.PRICE]: "价格变化",
    [RefundReasonType.DESCRIBE]: "商品与页面描述不符",
    [RefundReasonType.OTHER]: "其他",
}

export const ExpressStatus = {
    NO_RECORD: 1,
    ON_WAY: 2,
    DLIVERY: 3,
    SIGN: 4,
    REJECT: 5,
    DIFFICULT: 6,
    INVALID: 7,
    TIMEOUT: 8,
    SIGN_FAIL: 9,
    REFUND: 10
}

export const ExpressStatusLabel = {
    [ExpressStatus.NO_RECORD]: "暂无记录",
    [ExpressStatus.ON_WAY]: "在途中",
    [ExpressStatus.DLIVERY]: "派送中",
    [ExpressStatus.SIGN]: "已签收",
    [ExpressStatus.REJECT]: "用户拒签",
    [ExpressStatus.DIFFICULT]: "疑难件",
    [ExpressStatus.INVALID]: "无效",
    [ExpressStatus.TIMEOUT]: "已超时",
    [ExpressStatus.SIGN_FAIL]: "签收失败",
    [ExpressStatus.REFUND]: "退回",
}

export const CouponType = {
    FULL_REDUCTION: 1,
    DIRECT_REDUCTION: 2,
    FULL_DISCOUNT: 3,
    DISCOUNT: 4,
    TOURISM: 5
}

export const CouponTypeObj = {
    [CouponType.FULL_REDUCTION]: { label: "满减" },
    [CouponType.DIRECT_REDUCTION]: { label: "直减" },
    [CouponType.FULL_DISCOUNT]: { label: "满折" },
    [CouponType.DISCOUNT]: { label: "折扣" },
    [CouponType.TOURISM]: { label: "旅游" },
}

export const CouponRangeType = {
    ALL: 1,
    CATEGORY: 2,
    GOODS: 3
}

export const CouponRangeTypeLabel = {
    [CouponRangeType.ALL]: '全场通用',
    [CouponRangeType.CATEGORY]: '指定类目',
    [CouponRangeType.GOODS]: '指定商品',
}

export const PromotionType = {
    VIP: 1,
    FULL_REDUCTION: 2,
    EVERY_REDUCTION: 3,
    DIRECT_REDUCTION: 4,
    DISCOUNT: 5,
    FULL_DISCOUNT: 6,
}

export const PromotionTypeLabel = {
    [PromotionType.VIP]: "会员优惠",
    [PromotionType.FULL_REDUCTION]: "满减",
    [PromotionType.EVERY_REDUCTION]: "每满减",
    [PromotionType.DIRECT_REDUCTION]: "直降",
    [PromotionType.DISCOUNT]: "折扣",
    [PromotionType.FULL_DISCOUNT]: "满折",
}

export const OrderConfirmType = {
    NORMAL: 1,
    TRANSFER: 2,
    PRE_SALE_DEPOSIT: 3,
    PRE_SALE_BALANCE: 4,
    AUCTION_DEPOSIT: 5,
    AUCTION_BALANCE: 6,
    NFT: 7
}

export const OrderConfirmTypeObj = {
    [SalesType.NORMAL]:{
        [OrderConfirmType.NORMAL]: {
            api: "submitOrder",
            comm: {
                coupon: true,
                promotion: true,
                integral: true
            }
        },
        [OrderConfirmType.TRANSFER]: {
            api: "transferSubmitOrder",
            comm: {
            }
        },
        [OrderConfirmType.PRE_SALE_DEPOSIT]: {
            api: "submitOrder"
        },
        [OrderConfirmType.PRE_SALE_BALANCE]: {
            api: "submitOrder"
        },
        [OrderConfirmType.AUCTION_DEPOSIT]: {
            api: "submitOrder"
        },
        [OrderConfirmType.AUCTION_BALANCE]: {
            api: "submitOrder"
        },
        [OrderConfirmType.NFT]: {
            api: "submitOrder",
            comm: {
            }
        },
    },
    [SalesType.BLINDBOX]:{
        [OrderConfirmType.NORMAL]: {
            api: "BlindBoxSubmitOrder",
            comm: {
                coupon: true,
                promotion: true,
                integral: true
            }
        },
        [OrderConfirmType.TRANSFER]: {
            api: "BlindBoxSubmitOrder",
            comm: {
            }
        },
        [OrderConfirmType.PRE_SALE_DEPOSIT]: {
            api: "BlindBoxSubmitOrder"
        },
        [OrderConfirmType.PRE_SALE_BALANCE]: {
            api: "BlindBoxSubmitOrder"
        },
        [OrderConfirmType.AUCTION_DEPOSIT]: {
            api: "BlindBoxSubmitOrder"
        },
        [OrderConfirmType.AUCTION_BALANCE]: {
            api: "BlindBoxSubmitOrder"
        },
        [OrderConfirmType.NFT]: {
            api: "BlindBoxSubmitOrder",
            comm: {
            }
        },
    }
    
}

export const PayType = {
    ...OrderConfirmType,
    WITHDRAW_GOODS: 100
}

export const PayTypeObj = {
    [PayType.NORMAL]: {
        api: "submitPay",
        detailApi: 'getPayInfo',
        showLeftTime: true,
        timeoutBtnDisabled: true,
        unPaidAmtKey: "unpaidAmount",
        paidAmtKey: "paidAmount",
        stateKey: "state",
        stateMap: {
            success: 1,
            fail: 2,
            loading: 3,
        },
        payTypeKey: "payType",
        toOrderName: "order-list",
        smsType: 1
    },
    [PayType.TRANSFER]: {
        api: "submitTransferPay",
        detailApi: 'getTransferPayDetail',
        showLeftTime: true,
        unPaidAmtKey: "amount",
        paidAmtKey: "paidAmount",
        stateKey: "status",
        stateMap: {
            success: 1,
            fail: 2,
            loading: 3,
        },
        payTypeKey: "payType",
        toOrderName: "order-list",
        smsType: 2
    },
    [PayType.WITHDRAW_GOODS]: {
        api: "payPostfeeByCoin",
        detailApi: 'getPayInfo',
        showLeftTime: false,
        timeoutBtnDisabled: false,
        unPaidAmtKey: "unpaidAmount",
        paidAmtKey: "paidAmount",
        stateKey: "state",
        stateMap: {
            success: 1,
            fail: 2,
            loading: 3,
        },
        payTypeKey: "payType",
        toOrderName: "order-list",
        smsType: 1
    },
    [PayType.NFT]: {
        api: "submitPay",
        detailApi: 'getPayInfo',
        showLeftTime: true,
        timeoutBtnDisabled: true,
        unPaidAmtKey: "unpaidAmount",
        paidAmtKey: "paidAmount",
        stateKey: "state",
        stateMap: {
            success: 1,
            fail: 2,
            loading: 3,
        },
        payTypeKey: "payType",
        toOrderName: "order-list",
        smsType: 1
    },
}