|
|
- package ordercalc
-
- /**
- '0': 待支付 下单,尚未支付 created
- '1':已支付 付款成功,此状态可退款 payed
- '5':已验证 虚拟订单,验证核销码 using
- '6':已完成 与供应商结算后,订单结束。配送订单配送完成 finished
- '7':已取消 订单取消 canceled
- '8':自动取消 到期未支付自动取消,此状态可由管理员手动延期取消 autocanceled
- '9':申请退款 用户自助申请退订单,此状态可退款
- '13':已退款 订单完成退款 refunded
- '15':自动完成 使用时间过期,自动完成。 finished
-
- cancel,received,payed,created,finished,using
-
- ## 发货
- is_delivery 是否发货 '1': 已发货
- delivery 发货时间
-
- ## 收货
- is_received 是否收货 '1': 已收货
- received 收货时间
- */
-
- var statusList map[string]string = map[string]string{
- "0": "created",
- "1": "payed",
- "5": "using",
- "6": "finished",
- "7": "canceled",
- "8": "autocanceled",
- "9": "askForRefund",
- "13": "refunded",
- "15": "autofinished",
- }
- var statusExtendList map[string]string = map[string]string{
- "6": "received", //已收货归入已完成,
- }
-
- /*串货订单,供应商系统订单状态*/
- var channelOrderStatusList map[string]string = map[string]string{
- "1": "nosend",
- "2": "created",
- "3": "payed",
- "4": "askForRefund",
- "5": "refunded",
- "6": "canceled",
- "7": "finished",
- "8": "payFailed", //支付失败
- "9": "breakoff", //断开
- "10": "fullRefund", //全额退款
- "14": "autocanceled",
- "15": "autofinished",
- "16": "delivered",
- }
-
- func GetOrderStatusKey(status string) (key string) {
- for k, val := range statusList {
- if val == status {
- key = k
- break
- }
- }
- if key == "" { //再找扩展的状态
- for k, val := range statusExtendList {
- if val == status {
- key = k
- break
- }
- }
- }
- return
- }
-
- func GetOrderStatusText(key string) (text string) {
-
- for k, val := range statusList {
- if k == key {
- text = val
- break
- }
- }
- if text == "" { //再找扩展的状态
- for k, val := range statusExtendList {
- if k == key {
- text = val
- break
- }
- }
- }
- return
- }
-
- /**
- * 返回订单状态描述
- * 2021/01/28
- */
- func GetOrderStatusDescByFlag(flag string) (text string) {
- status := GetStatusText(flag)
- return GetStatusDesc(status)
- }
-
- /**
- * 返回订单状态描述
- * 2020/10/22
- */
- func GetOrderStatusDesc(key string) (text string) {
- var statusDesc map[string]string = map[string]string{
- "created": "已创建",
- "payed": "已支付",
- "askForRefund": "请求退款",
- "using": "使用中",
- "finished": "已完成",
- "canceled": "已取消",
- "autocanceled": "自动取消",
- "refunded": "已退款",
- "autofinished": "自动完成",
- "received": "已收货",
- }
- for k, val := range statusDesc {
- if k == key {
- text = val
- break
- }
- }
- return
- }
-
- func GetChannelOrderStatusKey(status string) (key string) {
- for k, val := range channelOrderStatusList {
- if val == status {
- key = k
- break
- }
- }
- return
- }
-
- func GetChannelOrderStatusText(key string) (text string) {
- for k, val := range channelOrderStatusList {
- if k == key {
- text = val
- break
- }
- }
- return
- }
-
- /**
- * 返回订单状态描述
- * 2020/10/22
- */
- func GetChannelOrderStatusDesc(key string) (text string) {
- var statusDesc map[string]string = map[string]string{
- "nosend": "未发送",
- "created": "已创建",
- "payed": "已支付",
- "askForRefund": "请求退款",
- "refunded": "已退款",
- "canceled": "已取消",
- "finished": "已完成",
- "payFailed": "支付失败",
- "breakoff": "断开",
- "fullRefund": "全额退款",
- "autocanceled": "自动取消",
- "autofinished": "自动取消",
- "delivered": "已发货",
- }
- for k, val := range statusDesc {
- if k == key {
- text = val
- break
- }
- }
- return
- }
|