diff --git a/business/model/const.go b/business/model/const.go index 164813d84..0161b46d0 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -22,6 +22,15 @@ var ( }, } + //ShopChineseNames = map[int]string{ + // VendorIDJD: globals.StoreName, + // VendorIDMTWM: globals.StoreNameMtwm, + // VendorIDELM: globals.StoreNameEbai, + // VendorIDEBAI: globals.StoreNameEbai, + // VendorIDJX: fmt.Sprintf("%s商城", globals.StoreName), + // VendorIDWSC: "微盟微商城", + //} + OrderStatusName = map[int]string{ OrderStatusMsg: "通知消息", OrderStatusWaybillTipChanged: "小费变动", @@ -65,6 +74,7 @@ var ( WaybillStatusPending: "压单", WaybillStatusAcceptCanceled: "取消接受", WaybillStatusAccepted: "已接单", + WaybillStatusCourierAssigned: "已分配骑手", WaybillStatusCourierArrived: "已到店", WaybillStatusApplyFailedGetGoods: "取货失败待审核", WaybillStatusAgreeFailedGetGoods: "取货失败", @@ -80,15 +90,6 @@ var ( OrderTypeAfsOrder: "售后单", } - UnionOrderStatusName = map[int]string{ - UnionOrderStatusNew: "新订单", - UnionOrderStatusPay: "用户已支付", - UnionOrderStatusTakeOver: "用户已确认收货", - UnionOrderStatusAuditOver: "已审核", - UnionOrderStatusFinish: "已完成(已结算)", - UnionOrderStatusFail: "已退款(结算失败)", - } - ComplaintReasons = map[int]string{ ComplaintReasons1: "骑手态度恶劣", ComplaintReasons2: "骑手接单后未取货", @@ -113,6 +114,13 @@ var ( // OperateCopyStoreSkus: "复制门店商品", } + //ThingTypeName = map[int]string{ + // ThingTypeCategory: "分类", + // ThingTypeSku: "门店商品", + // ThingTypeSkuName: "商品库", + // ThingTypeStore: "门店", + //} + ApiFunctionName = map[string]string{ "UpdateStoresSkus": "门店商品管理", "UpdateStoresSkusSale": "门店商品可售状态修改", @@ -138,6 +146,7 @@ var ( MultiStoresVendorMap = map[int]int{ VendorIDJD: 1, VendorIDMTWM: 0, + VendorIDELM: 0, VendorIDEBAI: 0, } @@ -171,6 +180,11 @@ var ( "打印机ID", "打印机密钥", }, + VendorIDJxprint: []string{ + VendorChineseNames[VendorIDJxprint], + "打印机编号", + "不填", + }, } AfsReasonTypeName = map[int]string{ AfsReasonTypeGoodsQuality: "商品质量", @@ -250,7 +264,6 @@ const ( OrderStatusEndBegin = 100 // 以下的状态就是结束状态 OrderStatusFinished = 110 // 订单已完成 - OrderStatusConfirm = 112 //一件代发订单确认收货 OrderStatusCanceled = 115 // 订单已取消 OrderStatusEndEnd = 120 @@ -262,15 +275,13 @@ const ( AfsOrderStatusFailed = 190 // 售后单失败 ) -//联盟订单状态 const ( - UnionOrderStatusNew = 10 //已领券?还未支付 - UnionOrderStatusPay = 15 //已支付 - UnionOrderStatusTakeOver = 20 //确认收货,已收到货 - UnionOrderStatusAuditOver = 25 //审核成功,待结算 + ApplyRefund = +) - UnionOrderStatusFinish = 110 //已结算 - UnionOrderStatusFail = 115 //审核失败,结算失败 +const ( + LockStatusUnlocked = 0 + LockStatusLocked = 1 ) //投诉原因 @@ -302,17 +313,18 @@ const ( WaybillStatusRefuseFailedGetGoods = -70 WaybillStatusUnknown = 0 - WaybillStatusNew = 5 - WaybillStatusPending = 7 - WaybillStatusAcceptCanceled = 8 - WaybillStatusAccepted = 10 - WaybillStatusCourierArrived = 15 // 此状态是可选的,明确写出来是因为还是较重要的状态,但业务逻辑不应依赖此状态 + WaybillStatusNew = 5 // 新建订单 + WaybillStatusPending = 7 // + WaybillStatusAcceptCanceled = 8 // 取消运单 + WaybillStatusAccepted = 10 // 分配骑手,正在接单 + WaybillStatusCourierAssigned = 12 //已分配骑手 + WaybillStatusCourierArrived = 15 // 此状态是可选的,明确写出来是因为还是较重要的状态,但业务逻辑不应依赖此状态 WaybillStatusApplyFailedGetGoods = 17 // 取货失败待审核 WaybillStatusAgreeFailedGetGoods = 18 // 取货失败 - WaybillStatusDelivering = 20 - WaybillStatusDeliverFailed = 22 + WaybillStatusDelivering = 20 // 配送中 + WaybillStatusDeliverFailed = 22 // 配送中失败 WaybillStatusEndBegin = 100 // 以下的状态就是结束状态 WaybillStatusDelivered = 105 // todo 这个应该改为110,与订单对应 @@ -321,6 +333,11 @@ const ( WaybillStatusEndEnd = 120 ) +const ( + BusinessTypeImmediate = 1 + BusinessTypeDingshida = 2 +) + var ( ElmSkuPromotion = map[int]int{ 11: 1, @@ -328,6 +345,52 @@ var ( } ) +const ( + JdPlatformFeeRate = 10 + MtPlatformFeeRate = 10 +) + +const ( + OrderDeliveryFlagMaskScheduleDisabled = 1 // 禁止三方配送调度 + OrderDeliveryFlagMaskPurcahseDisabled = 2 // 购物平台已不配送(一般为门店配送类型本身为自配送,或已经转自配送) + + OrderDeliveryFlagMaskAutoPickup = 4 // 是否是自动拣货的 + + OrderDeliveryFlagMaskDada = 16 // 创建达达运单中 + OrderDeliveryFlagMaskMtps = 32 // 创建美团配送运单中 +) + +const ( + WaybillDeliveryFlagMaskActiveCancel = 1 // 主动取消 +) + +const ( + OrderFlagMaskPrinted = 1 // 已经打印 + + OrderFlagMaskUserApplyCancel = 6 + OrderFlagAgreeUserApplyCancel = 2 + OrderFlagRefuseUserApplyCancel = 6 + + OrderFlagMaskFailedGetGoods = 24 + OrderFlagAgreeFailedGetGoods = 8 + OrderFlagRefuseFailedGetGoods = 24 + + OrderFlagMaskFailedDeliver = 32 + OrderFlagMaskCallPMCourier = 64 // 取货失败后召唤平台配送 + OrderFlagMaskSetDelivered = 128 // 设置送达 + + OrderFlagMaskFake = 256 // 假订单,即刷单用的 + OrderFlagMaskTempJX = 512 // 临时京西订单 +) + +const ( + AfsOrderFlagMaskUserRefund = 3 // 门店处理售后单申请 + AfsOrderFlagAgreeUserRefund = 1 // 门店同意售后单申请 + AfsOrderFlagRefuseUserRefund = 3 // 门店拒绝售后单申请 + + AfsOrderFlagMaskReturnGoods = 4 // 门店确认收到退货 +) + const ( AfsAppealTypeRefund = 1 // 仅退款 AfsAppealTypeReturnAndRefund = 2 // 退货退款 @@ -348,6 +411,12 @@ const ( AfsReasonNotOthers = 0 // 其它 ) +const ( + AfsTypeUnknown = 0 // 未知 + AfsTypePartRefund = 1 // 部分退款 + AfsTypeFullRefund = 2 // 全额退款 +) + const ( DefaultEarningPricePercentage = 70 // 门店缺省结算百分比 @@ -357,11 +426,39 @@ const ( ) const ( - YES = 1 //通用 - NO = 0 - DISABLED = -1 + YES = 1 //通用 + NO = 0 + DISABLED = -1 + B2BTag = "B2B" + B2BNumberId = 10 ) +const ( + WeChatQrCode = "weChat" + TiktokQrCode = "tiktok" +) + +const ( + DefaultName = "石锋" + DefaultPhone = "18048531223" + DefaultIdCard = "610126198012230014" +) + +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 } @@ -386,6 +483,15 @@ func IsVendorRemote(vendorID int) bool { return vendorID >= VendorIDJD && vendorID <= VendorIDEBAI } +func WaybillVendorID2Mask(vendorID int) (mask int8) { + if vendorID == VendorIDDada { + mask = OrderDeliveryFlagMaskDada + } else if vendorID == VendorIDMTPS { + mask = OrderDeliveryFlagMaskMtps + } + return mask +} + func IsAfsOrderFinalStatus(status int) bool { return status >= AfsOrderStatusFinished && status <= AfsOrderStatusFailed } @@ -393,3 +499,405 @@ func IsAfsOrderFinalStatus(status int) bool { func IsWaybillFinalStatus(status int) bool { return status >= WaybillStatusEndBegin && status <= WaybillStatusEndEnd } + +const ( + JXC4AppId = "wx4b5930c13f8b1170" // 京西菜市appId + JXC4BusinessAppId = "wx08a5c2a8581414ff" // 京西商家appId + JXC4TiktokAppId = "tta6a1d01c399f264201" // 抖音appID +) + +//package model +// +//import ( +// "git.rosy.net.cn/baseapi/platformapi/ebaiapi" +// "git.rosy.net.cn/baseapi/platformapi/jdapi" +// "git.rosy.net.cn/baseapi/platformapi/mtwmapi" +//) +// +//var ( +// PurchaseVendorInfo = map[int]map[string]interface{}{ +// VendorIDJD: map[string]interface{}{ +// "chineseName": VendorChineseNames[VendorIDJD], +// "userApplyCancelWaitMinute": jdapi.UserApplyCancelWaitMinute, +// }, +// VendorIDMTWM: map[string]interface{}{ +// "chineseName": VendorChineseNames[VendorIDMTWM], +// "userApplyCancelWaitMinute": mtwmapi.UserApplyCancelWaitMinute, +// }, +// VendorIDEBAI: map[string]interface{}{ +// "chineseName": VendorChineseNames[VendorIDEBAI], +// "userApplyCancelWaitMinute": ebaiapi.UserApplyCancelWaitMinute, +// }, +// } +// +// OrderStatusName = map[int]string{ +// OrderStatusMsg: "通知消息", +// OrderStatusWaybillTipChanged: "小费变动", +// OrderStatusRefuseFailedGetGoods: "取货失败审核驳回", +// OrderStatusAdjust: "订单调整完成", +// OrderStatusApplyUrgeOrder: "催单", +// +// OrderStatusUnlocked: "解锁", +// OrderStatusLocked: "锁定", +// // OrderStatusApplyRefund: "申请退款", +// OrderStatusUndoApplyCancel: "取消申请取消", +// OrderStatusVendorRejectCancel: "拒绝取消", +// OrderStatusVendorAgreeCancel: "同意取消", +// OrderStatusApplyCancel: "申请取消", +// +// OrderStatusUnknown: "一般事件", +// +// OrderStatusWait4Pay: "待付款", +// OrderStatusNew: "新订单", +// OrderStatusWaitAccepted: "待接单", +// OrderStatusAccepted: "待拣货", +// OrderStatusFinishedPickup: "待配送", +// OrderStatusApplyFailedGetGoods: "取货失败待审核", +// OrderStatusAgreeFailedGetGoods: "取货失败", +// OrderStatusDelivering: "配送中", +// OrderStatusDeliverFailed: "投递失败", +// OrderStatusFinished: "完成", +// OrderStatusCanceled: "取消", +// +// AfsOrderStatusWait4Approve: "待审核", +// AfsOrderStatusNew: "已审核", +// AfsOrderStatusWait4ReceiveGoods: "退货待确认", +// AfsOrderStatusReceivedGoods: "退货已收到", +// AfsOrderStatusFinished: "售后成功", +// AfsOrderStatusFailed: "售后失败", +// } +// WaybillStatusName = map[int]string{ +// WaybillStatusUnknown: "一般事件", +// +// WaybillStatusNew: "新运单", +// WaybillStatusPending: "压单", +// WaybillStatusAcceptCanceled: "取消接受", +// WaybillStatusAccepted: "已接单", +// WaybillStatusCourierArrived: "已到店", +// WaybillStatusApplyFailedGetGoods: "取货失败待审核", +// WaybillStatusAgreeFailedGetGoods: "取货失败", +// WaybillStatusDelivering: "配送中", +// WaybillStatusDeliverFailed: "投递失败", +// WaybillStatusDelivered: "送达", +// WaybillStatusCanceled: "取消", +// WaybillStatusFailed: "失败", +// } +// OrderTypeName = map[int]string{ +// OrderTypeOrder: "订单", +// OrderTypeWaybill: "运单", +// OrderTypeAfsOrder: "售后单", +// } +// +// UnionOrderStatusName = map[int]string{ +// UnionOrderStatusNew: "新订单", +// UnionOrderStatusPay: "用户已支付", +// UnionOrderStatusTakeOver: "用户已确认收货", +// UnionOrderStatusAuditOver: "已审核", +// UnionOrderStatusFinish: "已完成(已结算)", +// UnionOrderStatusFail: "已退款(结算失败)", +// } +// +// ComplaintReasons = map[int]string{ +// ComplaintReasons1: "骑手态度恶劣", +// ComplaintReasons2: "骑手接单后未取货", +// ComplaintReasons3: "骑手取货太慢", +// ComplaintReasons4: "骑手送货太慢", +// ComplaintReasons5: "货品未送达", +// ComplaintReasons6: "货品有损坏", +// ComplaintReasons7: "骑手违规收取顾客其他费用", +// ComplaintReasons69: "骑手恶意取消订单", +// ComplaintReasons71: "骑手提前点击取货/送达", +// } +// +// SupplementTypeName = map[int]string{ +// BadAppraiseSupplement: "差评退款", +// Coupon: "优惠券", +// } +// +// OperateTypeName = map[int]string{ +// OperateAdd: "新增", +// OperateUpdate: "修改", +// OperateDelete: "删除", +// // OperateCopyStoreSkus: "复制门店商品", +// } +// +// ApiFunctionName = map[string]string{ +// "UpdateStoresSkus": "门店商品管理", +// "UpdateStoresSkusSale": "门店商品可售状态修改", +// "CopyStoreSkus": "京西门店商品复制到京西", +// "UpdateStore": "门店管理-更新门店信息", +// "CreateStore": "门店管理-创建门店", +// "DeleteStore": "门店管理-删除门店", +// "DeleteStoreVendorMap": "门店解绑", +// "AddStoreVendorMap": "门店绑定", +// "UpdateStoreVendorMap": "门店修改平台绑定信息", +// "DeleteStoreCourierMap": "门店解绑三方配送平台", +// "AddStoreCourierMap": "门店绑定三方配送平台", +// "UpdateStoreCourierMap": "门店修改三方配送平台绑定信息", +// "Login": "登录", +// "RegisterUser": "注册", +// "AutoPayForPopluarMan": "每日订单打款", +// "SyncStoresQualify": "上传门店营业资质", +// "CancelOrder": "取消订单", +// "UpdateSku": "修改sku", +// "UpdateSkuName": "修改skuName", +// } +// +// MultiStoresVendorMap = map[int]int{ +// VendorIDJD: 1, +// VendorIDMTWM: 0, +// VendorIDEBAI: 0, +// } +// +// ZXCityCodeMap = map[int]string{ +// 310100: "上海市", +// 110100: "北京市", +// 120100: "天津市", +// 440300: "深圳市", +// 500100: "重庆市", +// 441900: "东莞", +// } +// +// PrinterVendorInfo = map[int][]string{ +// VendorIDFeiE: []string{ +// VendorChineseNames[VendorIDFeiE], +// "序列号", +// "KEY", +// }, +// VendorIDXiaoWM: []string{ +// VendorChineseNames[VendorIDXiaoWM], +// "打印机编号", +// "不填", +// }, +// VendorIDYiLianYun: []string{ +// VendorChineseNames[VendorIDYiLianYun], +// "终端号", +// "密钥", +// }, +// VendorIDZhongWu: []string{ +// VendorChineseNames[VendorIDZhongWu], +// "打印机ID", +// "打印机密钥", +// }, +// } +// AfsReasonTypeName = map[int]string{ +// AfsReasonTypeGoodsQuality: "商品质量", +// AfsReasonTypeWrongGoods: "错误的商品", +// AfsReasonTypeMissingGoods: "缺少部分商品", +// AfsReasonTypeNoGoods: "全部商品未收到", +// AfsReasonTypeDamagedGoods: "商品有损伤", +// AfsReasonTypeGoodsQuantity: "缺斤少两", +// AfsReasonTypeGoodsAbsent: "商家通知我缺货", +// AfsReasonTypeGoodsNoSame: "商品与描述不符", +// AfsReasonWrongPurchase: "误购", +// AfsReasonNotReceivedIntime: "未在时效内送达", +// AfsReasonNotOthers: "其它", +// } +// AfsAppealTypeName = map[int]string{ +// AfsAppealTypeRefund: "仅退款", +// AfsAppealTypeReturnAndRefund: "退款", // 这个其实是退货退款,强制显示成退款 +// AfsAppealTypeNewGoods: "退款.", // 这个其实是重发商品,强制显示成退款 +// } +// VendorStatus = map[int]string{ +// 0: "休息", +// 1: "营业", +// } +//) +// +//const ( +// OrderTypeOrder = 1 +// OrderTypeWaybill = 2 +// OrderTypeAfsOrder = 3 +//) +// +//// 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 +// +// OrderStatusWaybillTipChanged = -80 // 订单小费变化 +// +// OrderStatusRefuseFailedGetGoods = -70 // 取货失败审核驳回 +// OrderStatusAdjust = -65 // 原值-35 订单调整完成 +// OrderStatusApplyUrgeOrder = -55 // 原值-15 +// +// OrderStatusUnlocked = -25 +// OrderStatusLocked = -20 +// OrderStatusUndoApplyCancel = -10 +// OrderStatusVendorRejectCancel = -7 +// OrderStatusVendorAgreeCancel = -6 +// OrderStatusApplyCancel = -5 +// +// OrderStatusUnknown = 0 +// OrderStatusWait4Pay = 2 // 原值-60 下单待支付 +// OrderStatusWaitAccepted = 3 // 待接单,目前饿百用 +// OrderStatusNew = 5 // 新订单,实际是已经支付 +// OrderStatusAccepted = 10 // 已经接单,也即待出库,待拣货 +// OrderStatusFinishedPickup = 15 // 拣货完成 +// +// OrderStatusApplyFailedGetGoods = 17 // 取货失败待审核 +// OrderStatusAgreeFailedGetGoods = 18 // 取货失败 +// +// OrderStatusDelivering = 20 // 开始配送,配送员已取货,从这里开始就是运单消息了 +// OrderStatusDeliverFailed = 22 // 投递失败 +// +// OrderStatusEndBegin = 100 // 以下的状态就是结束状态 +// OrderStatusFinished = 110 // 订单已完成 +// OrderStatusConfirm = 112 //一件代发订单确认收货 +// OrderStatusCanceled = 115 // 订单已取消 +// OrderStatusEndEnd = 120 +// +// AfsOrderStatusWait4Approve = 155 // 待审核售后单 +// AfsOrderStatusNew = 160 // 已审核或不需要审核售后单 +// AfsOrderStatusWait4ReceiveGoods = 165 // 退款退货的,需要商家确认收到货 +// AfsOrderStatusReceivedGoods = 167 // 已确认收到货 +// AfsOrderStatusFinished = 180 // 售后单成功完成 +// AfsOrderStatusFailed = 190 // 售后单失败 +//) +// +////联盟订单状态 +//const ( +// UnionOrderStatusNew = 10 //已领券?还未支付 +// UnionOrderStatusPay = 15 //已支付 +// UnionOrderStatusTakeOver = 20 //确认收货,已收到货 +// UnionOrderStatusAuditOver = 25 //审核成功,待结算 +// +// UnionOrderStatusFinish = 110 //已结算 +// UnionOrderStatusFail = 115 //审核失败,结算失败 +//) +// +////投诉原因 +//const ( +// ComplaintReasons1 = 1 //"骑手态度恶劣", +// ComplaintReasons2 = 2 //"骑手接单后未取货" +// ComplaintReasons3 = 3 //"骑手取货太慢", +// ComplaintReasons4 = 4 //"骑手送货太慢", +// ComplaintReasons5 = 5 //"货品未送达", +// ComplaintReasons6 = 6 //"货品有损坏", +// ComplaintReasons7 = 7 //"骑手违规收取顾客其他费用", +// ComplaintReasons69 = 69 //"骑手恶意取消订单", +// ComplaintReasons71 = 71 //"骑手提前点击取货/送达", +//) +// +//const ( +// BadAppraiseSupplement = 1 //差评退款 +// Coupon = 2 //优惠券 +//) +// +//const ( +// OperateAdd = 2 //新增操作 +// OperateUpdate = 1 //修改操作 +// OperateDelete = 4 //删除操作 +// OperateCopyStoreSkus = 3 //复制门店商品 +//) +// +//const ( +// WaybillStatusRefuseFailedGetGoods = -70 +// WaybillStatusUnknown = 0 +// +// WaybillStatusNew = 5 +// WaybillStatusPending = 7 +// WaybillStatusAcceptCanceled = 8 +// WaybillStatusAccepted = 10 +// WaybillStatusCourierArrived = 15 // 此状态是可选的,明确写出来是因为还是较重要的状态,但业务逻辑不应依赖此状态 +// +// WaybillStatusApplyFailedGetGoods = 17 // 取货失败待审核 +// WaybillStatusAgreeFailedGetGoods = 18 // 取货失败 +// +// WaybillStatusDelivering = 20 +// WaybillStatusDeliverFailed = 22 +// +// WaybillStatusEndBegin = 100 // 以下的状态就是结束状态 +// WaybillStatusDelivered = 105 // todo 这个应该改为110,与订单对应 +// WaybillStatusCanceled = 115 +// WaybillStatusFailed = 120 // 这个状态存在的意义是区分于WaybillStatusCanceled,比如达达平台在这种状态下再次创建运单的方式不一样 +// WaybillStatusEndEnd = 120 +//) +// +//var ( +// ElmSkuPromotion = map[int]int{ +// 11: 1, +// 200: 1, +// } +//) +// +//const ( +// AfsAppealTypeRefund = 1 // 仅退款 +// AfsAppealTypeReturnAndRefund = 2 // 退货退款 +// AfsAppealTypeNewGoods = 3 // 重发新商品(即京东到家的直赔) +//) +// +//const ( +// AfsReasonTypeGoodsQuality = 1 // 商品质量 +// AfsReasonTypeWrongGoods = 2 // 错误的商品 +// AfsReasonTypeMissingGoods = 3 // 缺少部分商品 +// AfsReasonTypeNoGoods = 4 // 全部商品未收到 +// AfsReasonTypeDamagedGoods = 5 // 商品有损伤 +// AfsReasonTypeGoodsQuantity = 6 // 缺斤少两 +// AfsReasonTypeGoodsAbsent = 7 // 商家通知缺货 +// AfsReasonTypeGoodsNoSame = 8 // 商品与描述不符 +// AfsReasonWrongPurchase = 9 // 误购 +// AfsReasonNotReceivedIntime = 10 // 未在时效内送达 +// AfsReasonNotOthers = 0 // 其它 +//) +// +//const ( +// DefaultEarningPricePercentage = 70 // 门店缺省结算百分比 +// +// MinVendorPricePercentage = 10 +// DefVendorPricePercentage = 100 // 平台缺省调价比例 +// MaxVendorPricePercentage = 400 +//) +// +//const ( +// YES = 1 //通用 +// NO = 0 +// DISABLED = -1 +//) +// +//func IsOrderLockStatus(status int) bool { +// return status == OrderStatusLocked || status == OrderStatusApplyCancel +//} +// +//func IsOrderUnlockStatus(status int) bool { +// return status == OrderStatusUnlocked || status == OrderStatusUndoApplyCancel || status == OrderStatusVendorAgreeCancel || status == OrderStatusVendorRejectCancel +//} +// +//func IsOrderMainStatus(status int) bool { +// return status > OrderStatusUnknown +//} +// +//func IsOrderFinalStatus(status int) bool { +// return status >= OrderStatusEndBegin && status <= OrderStatusEndEnd +//} +// +//func IsOrderImportantStatus(status int) bool { +// return IsOrderMainStatus(status) || IsOrderLockStatus(status) || IsOrderUnlockStatus(status) +//} +// +//func IsVendorRemote(vendorID int) bool { +// return vendorID >= VendorIDJD && vendorID <= VendorIDEBAI +//} +// +//func IsAfsOrderFinalStatus(status int) bool { +// return status >= AfsOrderStatusFinished && status <= AfsOrderStatusFailed +//} +// +//func IsWaybillFinalStatus(status int) bool { +// return status >= WaybillStatusEndBegin && status <= WaybillStatusEndEnd +//} diff --git a/business/model/print_temp_utils.go b/business/model/print_temp_utils.go index 4ebd349d4..159dad54c 100644 --- a/business/model/print_temp_utils.go +++ b/business/model/print_temp_utils.go @@ -152,7 +152,8 @@ func MakePrintMsgOnTempVoice(param map[string]string, setting *PrintSettingObj, // 打印机提示音设置(暂时不做) switch param[OrderStatusPrint] { - case "3", "5", "10": // 新订单 + // 新订单 + case utils.Int2Str(OrderStatusWaitAccepted), utils.Int2Str(OrderStatusNew), utils.Int2Str(OrderStatusAccepted): // 订单设置 if setting.OrderVoiceSetting.PrintOrder == SettingOpen { // 打印订单 textMsg, err := MakePrintMsgOnTemp(param, userId) @@ -160,59 +161,31 @@ func MakePrintMsgOnTempVoice(param map[string]string, setting *PrintSettingObj, return "", err } } - if setting.OrderVoiceSetting.OrderNotice == SettingOpen { // 订单通知 + if setting.OrderVoiceSetting.OrderNotice == SettingOpen && setting.SystemVoice == SettingClose { // 订单通知 printVoiceMsg += `%s%s` // 你来新订单了 printVoiceValue = append(printVoiceValue, NewOrderVoice) - switch param[VendOrIDPrint] { - case utils.Int2Str(VendorIDJD): // 京东 - printVoiceValue = append(printVoiceValue, JdVoice) - case utils.Int2Str(VendorIDMTWM): // 美团 - printVoiceValue = append(printVoiceValue, MtVoice) - case utils.Int2Str(VendorIDELM): // 饿了么 - printVoiceValue = append(printVoiceValue, ElmVoice) - case utils.Int2Str(VendorIDEBAI): // 饿百 - printVoiceValue = append(printVoiceValue, ElmVoice) - case utils.Int2Str(VendorIDJDShop): // 京东商城 - printVoiceValue = append(printVoiceValue, JdToHose) - case utils.Int2Str(VendorIDTT): // 抖音 - // 暂无 - } - if param[VendorOrderNoPrint] != "" { - switch len(param[VendorOrderNoPrint]) { - case 1: - printVoiceMsg += `%s` - printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint]]) - case 2: - printVoiceMsg += `%s` - printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][:1]+"0"]) - if param[VendorOrderNoPrint][1:] != "0" { - printVoiceMsg += `%s` - printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][1:]]) - } - case 3: - printVoiceMsg += `%s` - printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][0:1]+"00"]) - if param[VendorOrderNoPrint][1:2] == "0" && param[VendorOrderNoPrint][2:] == "0" { - - } else if param[VendorOrderNoPrint][1:2] == "0" && param[VendorOrderNoPrint][2:] != "0" { - printVoiceMsg += `%s` - printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][1:2]]) - printVoiceMsg += `%s` - printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][2:]]) - } else if param[VendorOrderNoPrint][1:2] != "0" && param[VendorOrderNoPrint][2:] == "0" { - printVoiceMsg += `%s` - printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][1:2]+"0"]) - } else if param[VendorOrderNoPrint][1:2] != "0" && param[VendorOrderNoPrint][2:] != "0" { - printVoiceMsg += `%s` - printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][1:2]+"0"]) - printVoiceMsg += `%s` - printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][2:]]) - } - } - } - printVoiceMsg += `%s` - printVoiceValue = append(printVoiceValue, OrderNoVoice) + printVoiceMsg, printVoiceValue = SyntheticSpeech(printVoiceMsg, printVoiceValue, param) } + // 取消打印 + case utils.Int2Str(OrderStatusCanceled): + // 订单设置 + if setting.OrderVoiceSetting.BusinessOrderCancel == SettingOpen { // 取消打印订单 + textMsg, err := MakePrintMsgOnTemp(param, userId) + if err != nil { + return "", err + } + } + if setting.OrderVoiceSetting.BusinessOrderCancelVoice == SettingOpen && setting.SystemVoice == SettingClose { + if setting.OrderVoiceSetting.OrderNotice == SettingOpen && setting.SystemVoice == SettingClose { // 订单取消语音通知 + printVoiceMsg, printVoiceValue = SyntheticSpeech(printVoiceMsg, printVoiceValue, param) + printVoiceMsg += `%s` // 你来新订单了 + printVoiceValue = append(printVoiceValue, CancelOrderVoice) + } + } + // 申请取消 + case "": + // 申请退款 + case utils.Int2Str(OrderStatusCanceled): case "15": // 待拣货 case "110": // 送达 @@ -223,3 +196,58 @@ func MakePrintMsgOnTempVoice(param map[string]string, setting *PrintSettingObj, } } + +// SyntheticSpeech 合成语音 (美团xxx号订单) +func SyntheticSpeech(printVoiceMsg string, printVoiceValue []interface{}, param map[string]string) (string, []interface{}) { + printVoiceMsg += `%s` // 美团 + switch param[VendOrIDPrint] { + case utils.Int2Str(VendorIDJD): // 京东 + printVoiceValue = append(printVoiceValue, JdVoice) + case utils.Int2Str(VendorIDMTWM): // 美团 + printVoiceValue = append(printVoiceValue, MtVoice) + case utils.Int2Str(VendorIDELM): // 饿了么 + printVoiceValue = append(printVoiceValue, ElmVoice) + case utils.Int2Str(VendorIDEBAI): // 饿百 + printVoiceValue = append(printVoiceValue, ElmVoice) + case utils.Int2Str(VendorIDJDShop): // 京东商城 + printVoiceValue = append(printVoiceValue, JdToHose) + case utils.Int2Str(VendorIDTT): // 抖音 + // 暂无 + } + if param[VendorOrderNoPrint] != "" { + switch len(param[VendorOrderNoPrint]) { + case 1: + printVoiceMsg += `%s` + printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint]]) + case 2: + printVoiceMsg += `%s` + printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][:1]+"0"]) + if param[VendorOrderNoPrint][1:] != "0" { + printVoiceMsg += `%s` + printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][1:]]) + } + case 3: + printVoiceMsg += `%s` + printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][0:1]+"00"]) + if param[VendorOrderNoPrint][1:2] == "0" && param[VendorOrderNoPrint][2:] == "0" { + + } else if param[VendorOrderNoPrint][1:2] == "0" && param[VendorOrderNoPrint][2:] != "0" { + printVoiceMsg += `%s` + printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][1:2]]) + printVoiceMsg += `%s` + printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][2:]]) + } else if param[VendorOrderNoPrint][1:2] != "0" && param[VendorOrderNoPrint][2:] == "0" { + printVoiceMsg += `%s` + printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][1:2]+"0"]) + } else if param[VendorOrderNoPrint][1:2] != "0" && param[VendorOrderNoPrint][2:] != "0" { + printVoiceMsg += `%s` + printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][1:2]+"0"]) + printVoiceMsg += `%s` + printVoiceValue = append(printVoiceValue, NumberVoiceMap[param[VendorOrderNoPrint][2:]]) + } + } + } + printVoiceMsg += `%s` + printVoiceValue = append(printVoiceValue, OrderNoVoice) + return printVoiceMsg, printVoiceValue +}