package model // VendorIDJD, VendorIDMTWM与VendorIDELM的定义和老系统是兼容的 const ( VendorIDUnknown = -1 VendorIDPurchaseBegin = 0 VendorIDJD = 0 VendorIDMTWM = 1 VendorIDELM = 2 VendorIDEBAI = 3 VendorIDJX = 9 // 这是一个假的京西VendorID VendorIDWSC = 11 // 微盟微商城 VendorIDPurchaseEnd = 11 VendorIDDeliveryBegin = 101 VendorIDDada = 101 VendorIDMTPS = 102 VendorIDFengNiao = 103 VendorIDDeliveryEnd = VendorIDFengNiao VendorIDPrinterBegin = 201 VendorIDFeiE = 201 // 飞鹅打印机 VendorIDXiaoWM = 202 // 外卖管家打印机 VendorIDYiLianYun = 203 // 易联云 VendorIDZhongWu = 204 // 中午云打印 VendorIDPrinterEnd = 204 ) var ( VendorNames = map[int]string{ VendorIDJD: "Jd", VendorIDMTWM: "Mtwm", VendorIDELM: "Elm", VendorIDEBAI: "Ebai", VendorIDWSC: "Wsc", VendorIDDada: "Dada", VendorIDMTPS: "Mtps", VendorIDFeiE: "Feie", VendorIDXiaoWM: "XiaoWM", VendorIDYiLianYun: "Yilianyun", VendorIDZhongWu: "ZhongWu", } VendorChineseNames = map[int]string{ VendorIDJD: "京东到家", VendorIDMTWM: "美团外卖", VendorIDELM: "饿了么", VendorIDEBAI: "饿百新零售", VendorIDWSC: "微盟微商城", VendorIDDada: "达达众包", VendorIDMTPS: "美团配送", VendorIDFeiE: "飞鹅", VendorIDXiaoWM: "外卖管家", VendorIDYiLianYun: "易联云", VendorIDZhongWu: "中午云", } ShopChineseNames = map[int]string{ VendorIDJD: "京西菜市", VendorIDMTWM: "美好菜市", VendorIDELM: "好菜鲜生", VendorIDEBAI: "好菜鲜生", VendorIDWSC: "京西菜市", } OrderStatusName = map[int]string{ OrderStatusMsg: "通知消息", OrderStatusRefuseFailedGetGoods: "取货失败审核驳回", OrderStatusAdjust: "订单调整完成", OrderStatusWait4Pay: "待付款", OrderStatusApplyUrgeOrder: "催单", OrderStatusUnlocked: "解锁", OrderStatusLocked: "锁定", // OrderStatusApplyRefund: "申请退款", OrderStatusUndoApplyCancel: "取消申请取消", OrderStatusApplyCancel: "申请取消", OrderStatusUnknown: "一般事件", OrderStatusNew: "新订单", OrderStatusAccepted: "已接单", OrderStatusFinishedPickup: "已拣货", OrderStatusApplyFailedGetGoods: "取货失败待审核", OrderStatusAgreeFailedGetGoods: "取货失败", OrderStatusDelivering: "配送中", OrderStatusDeliverFailed: "投递失败", OrderStatusFinished: "完成", OrderStatusCanceled: "取消", } WaybillStatusName = map[int]string{ WaybillStatusUnknown: "一般事件", WaybillStatusNew: "新运单", WaybillStatusAcceptCanceled: "取消接受", WaybillStatusAccepted: "已接单", WaybillStatusCourierArrived: "已到店", WaybillStatusDelivering: "配送中", WaybillStatusDelivered: "送达", WaybillStatusCanceled: "取消", WaybillStatusFailed: "失败", } OrderTypeName = map[int]string{ OrderTypeOrder: "订单", OrderTypeWaybill: "运单", } MultiStoresVendorMap = map[int]int{ VendorIDJD: 1, VendorIDMTWM: 0, VendorIDELM: 0, VendorIDEBAI: 0, } PrinterVendorInfo = map[int][]string{ VendorIDFeiE: []string{ VendorChineseNames[VendorIDFeiE], "序列号", "KEY", }, VendorIDXiaoWM: []string{ VendorChineseNames[VendorIDXiaoWM], "打印机编号", "不填", }, VendorIDYiLianYun: []string{ VendorChineseNames[VendorIDYiLianYun], "终端号", "密钥", }, VendorIDZhongWu: []string{ VendorChineseNames[VendorIDZhongWu], "打印机ID", "打印机密钥", }, } ) const ( OrderTypeOrder = 1 OrderTypeWaybill = 2 ) // https://blog.csdn.net/a13570320979/article/details/51366355 // 美团配送: // 坐标类型,0:火星坐标(高德,腾讯地图均采用火星坐标) 1:百度坐标 (默认值为0) // 京东: // 收货人地址定位类型(buyerCoordType值为空或为1时,定位类型为gps,如为其他值时,定位类型为非gps类型。) // 饿了么: // 只支持高德坐标 // 达达: // 只支持高德坐标 // 如下定义与美团配送兼容 const ( CoordinateTypeMars = 0 // 火星坐标,高德坐标,GCJ-02坐标系 CoordinateTypeBaiDu = 1 // 百度坐标,bd-09,在GCJ-02坐标系上再次偏移加密的坐标 CoordinateTypeMapbar = 2 CoordinateTypeGPS = 84 // 真实坐标,WGS-84原始坐标系 ) const ( OrderStatusMsg = -100 OrderStatusRefuseFailedGetGoods = -70 // 取货失败审核驳回 OrderStatusAdjust = -65 // 原值-35 订单调整完成 OrderStatusWait4Pay = -60 // 原值-30 下单待支付,微盟在这个时间发新订单事件 OrderStatusApplyUrgeOrder = -55 // 原值-15 OrderStatusUnlocked = -25 OrderStatusLocked = -20 // OrderStatusApplyRefund = -10 OrderStatusUndoApplyCancel = -10 OrderStatusApplyCancel = -5 OrderStatusUnknown = 0 OrderStatusNew = 5 // 新订单 OrderStatusAccepted = 10 // 已经接单,也即待出库,待拣货 OrderStatusFinishedPickup = 15 // 拣货完成 OrderStatusApplyFailedGetGoods = 17 // 取货失败待审核 OrderStatusAgreeFailedGetGoods = 18 // 取货失败 OrderStatusDelivering = 20 // 开始配送,配送员已取货,从这里开始就是运单消息了 OrderStatusDeliverFailed = 22 // 投递失败 OrderStatusEndBegin = 100 // 以下的状态就是结束状态 OrderStatusFinished = 110 // 订单已完成 OrderStatusCanceled = 115 // 订单已取消 ) const ( LockStatusUnlocked = 0 LockStatusLocked = 1 ) const ( WaybillStatusRefuseFailedGetGoods = -70 WaybillStatusUnknown = 0 WaybillStatusNew = 5 WaybillStatusAcceptCanceled = 8 WaybillStatusAccepted = 10 WaybillStatusCourierArrived = 15 // 此状态是可选的,明确写出来是因为还是较重要的状态,但业务逻辑不应依赖此状态 WaybillStatusApplyFailedGetGoods = 17 // 取货失败待审核 WaybillStatusAgreeFailedGetGoods = 18 // 取货失败 WaybillStatusDelivering = 20 WaybillStatusDeliverFailed = 22 WaybillStatusEndBegin = 100 // 以下的状态就是结束状态 WaybillStatusDelivered = 105 // todo 这个应该改为110,与订单对应 WaybillStatusCanceled = 115 WaybillStatusFailed = 120 // todo 这个应该要去掉 WaybillStatusNeverSend = 125 // 这个状态指的是平台方不愿意配送,门店自己想办法。与WaybillStatusAcceptCanceled不一样,WaybillStatusAcceptCanceled可能之后还会尝试配送 ) const ( BusinessTypeImmediate = 1 BusinessTypeDingshida = 2 ) var ( ElmSkuPromotion = map[int]int{ 11: 1, 200: 1, } ) const ( JdPlatformFeeRate = 10 MtPlatformFeeRate = 10 ) const ( OrderDeliveryFlagMaskScheduleDisabled = 1 // 禁止三方配送调度 OrderDeliveryFlagMaskPurcahseDisabled = 2 // 购物平台已不配送(一般为门店配送类型本身为自配送,或已经转自配送) ) const ( OrderFlagMaskPrinted = 1 // 已经打印 ) func IsPurchaseVendorExist(vendorID int) bool { _, ok := VendorNames[vendorID] return ok && vendorID >= VendorIDPurchaseBegin && vendorID <= VendorIDPurchaseEnd } func IsDeliveryVendorExist(vendorID int) bool { _, ok := VendorNames[vendorID] return ok && vendorID >= VendorIDDeliveryBegin && vendorID <= VendorIDDeliveryEnd } func IsPrinterVendorExist(vendorID int) bool { _, ok := VendorNames[vendorID] return ok && vendorID >= VendorIDPrinterBegin && vendorID <= VendorIDPrinterEnd } func IsOrderLockStatus(status int) bool { return status == OrderStatusLocked || status == OrderStatusApplyCancel } func IsOrderUnlockStatus(status int) bool { return status == OrderStatusUnlocked || status == OrderStatusUndoApplyCancel } func IsOrderMainStatus(status int) bool { return status > OrderStatusUnknown } func IsOrderFinalStatus(status int) bool { return status >= OrderStatusEndBegin } func IsOrderImportantStatus(status int) bool { return IsOrderMainStatus(status) || IsOrderLockStatus(status) || IsOrderUnlockStatus(status) }