// 权重大的在前面显示 基础是-1在最后 const merchantStatusMap = new Map([ [ 'NOT_RECEIVED', { name: '待商家接单', sort: 0, type: 'merchant', nowImgType: 'merchant', }, ], [ 'RECEIVED', { name: '商家已接单', sort: 0, type: 'merchant', nowImgType: 'merchant', }, ], [ 'REJECTED', { name: '商家已退单', sort: -1, type: 'merchant', }, ], [ 'COMPLETED', { name: '已完成', sort: -1, type: 'merchant', }, ], ]); const orderStatusMap = new Map([ [ 'UNPAID', { name: '订单未支付', sort: 1, type: 'order', }, ], [ 'PAID', { name: '用户已支付', sort: -1, type: 'order', }, ], [ 'RATED', { name: '待评价', sort: 0, type: 'order', }, ], [ 'CANCELLED', { name: '订单已取消', sort: -1, type: 'order', }, ], [ 'REFUNDED_PENDING', { name: '申请退款中', sort: -1, type: 'order', }, ], [ 'REFUNDING', { name: '退款中', sort: -1, type: 'order', }, ], [ 'REFUNDED', { name: '已退款', sort: -1, type: 'order', }, ], [ 'COMPLETED', { name: '已完成', sort: 2, type: 'order', }, ], ]); const RiderStatusMap = new Map([ [ 'NOT_RECEIVED', { name: '待骑手接单', sort: -1, type: 'rider', }, ], [ 'RECEIVED', { name: '骑手已接单', sort: 1, type: 'rider', nowImgType: 'rider', }, ], [ 'TAKE_MEAL', { name: '骑手已取餐', sort: 1, type: 'rider', nowImgType: 'rider', }, ], [ 'MEAL_DELIVERY', { name: '订单正在配送中', sort: 1, type: 'rider', nowImgType: 'rider', }, ], [ 'CARRY_OUT', { name: '订单已送达', sort: 1, type: 'rider', }, ], ]); const payMap = new Map([ [ 'ALI_PAY', { name: '支付宝', icon: 'alipay-square', iconColor: 'blue500', }, ], [ 'CASH_DELIVERY', { name: '货到付款', icon: 'wallet', iconColor: 'green500', }, ], [ 'CREDIT_CARD', { name: '信用卡', icon: 'creditcard', iconColor: 'red500', }, ], ]); function getStatusInfo(orderInfo) { const statusList = []; if (orderInfo.status) { statusList.push(orderStatusMap.get(orderInfo.status)); } if (orderInfo.merchantStatus) { statusList.push(merchantStatusMap.get(orderInfo.merchantStatus)); } if (orderInfo.riderStatus) { statusList.push(RiderStatusMap.get(orderInfo.riderStatus)); } if (statusList.length > 0) { return statusList.sort((a, b) => { return b.sort - a.sort; })[0]; } else { return { name: '订单详情', }; } } export { merchantStatusMap, orderStatusMap, RiderStatusMap, payMap, getStatusInfo, };