package otosaas import "git.oa00.com/go/otosaas/request" const ( afsApply = "/mall/v1/refundOrder/create" // 申请退款 afsDetail = "/mall/v1/refundOrder/detail" // 退款详情 afsRefund = "/mall/v1/refundOrder/refundSuccess" // 退款完成 afsLogisticsAddress = "/mall/v1/refundOrder/queryShopLogistics" // 退款寄回地址 afsBackLogisticsBill = "/mall/v1/refundOrder/saveReturnLogistics" // 提交退款物流 ) type afs struct { } type AfsApply struct { UserId string `json:"userId"` // 用户id CommodityStatus int `json:"commodityStatus"` // 订单状态 1=未收货 2=已收货 OrderId string `json:"orderId"` // 订单id ItemOrderIds []string `json:"itemOrderIds"` // 子订单号 Pics []string `json:"pics"` // 上传图片,最多4张 ReturnReasonValue string `json:"returnReasonValue"` // 退款原因 ReturnRemark string `json:"returnRemark"` // 退款备注 Type int `json:"type"` // 退款方式 1=仅退款 2=退货退款 ReturnType int `json:"returnType"` // 退款类型 0=整单退 1=单个退 } type respAfsApply struct { ReturnOrderId string `json:"returnOrderId"` } // Apply @Title 申请退款 func (a *afs) Apply(data AfsApply) (afsOrderId string, err error) { apply := respAfsApply{} err = request.Exec(afsApply, data, &apply) return apply.ReturnOrderId, err } type AfsDetail struct { OrderId string `json:"orderId"` // 订单id PassTime string `json:"passTime"` // 审核通过时间 ReceiverProvince string `json:"receiverProvince"` // 省 ReceiverCity string `json:"receiverCity"` // 市 FreightType int `json:"freightType"` // 是否退运费:1 - 退,2 - 不退 RealAmount float64 `json:"realAmount"` // 申请退款金额 ReceiverPhone string `json:"receiverPhone"` // 收货人联系方式 ReceiverPostCode string `json:"receiverPostCode"` // 收货人邮编 ReceiverRegion string `json:"receiverRegion"` // 区 CommodityStatus int `json:"commodityStatus"` // 商品状态 1=未收货 2=已收货 ReturnReason string `json:"returnReason"` // 退款原因 ReturnRemark string `json:"returnRemark"` // 退款备注 ReturnOrderId string `json:"returnOrderId"` // 退款单号 ReturnAmount float64 `json:"returnAmount"` // 实际退款金额 FreightAmount float64 `json:"freightAmount"` // 运费 ReceiverName string `json:"receiverName"` // 收件人 ReceiverDetailAddress string `json:"receiverDetailAddress"` // 详细地址 List []struct { CommoditySpecCode string `json:"commoditySpecCode"` // 规格编码 CommodityPic string `json:"commodityPic"` // 商品图片 FreightAmount float64 `json:"freightAmount"` // 子订单运费 CommoditySellingPrice float64 `json:"commoditySellingPrice"` // 商品价格 Num int `json:"num"` // 购买数量 ItemOrderId string `json:"itemOrderId"` // 子订单编号 RealAmount float64 `json:"realAmount"` // 实际付款金额 TotalAmount float64 `json:"totalAmount"` // 子订单总金额 CommodityCode string `json:"commodityCode"` // 商品编码 CommodityName string `json:"commodityName"` // 商品名称 } `json:"list"` CreateTime string `json:"createTime"` // 提交时间 LogisticsStatus int `json:"logisticsStatus"` // 0=未发货 1=已发货 2=已收货 Status int `json:"status"` // 退款状态 1->待审核;2->审核通过;3->退款成功 ;4 ->审核驳回;5 关闭 , 6退货退款申请通过 } // Detail @Title 售后详情 func (a *afs) Detail(afsOrderId, userId string) (result AfsDetail, err error) { err = request.Exec(afsDetail, map[string]interface{}{ "returnOrderId": afsOrderId, "userId": userId, }, &result) return } // Refund @Title 退款完成 func (a *afs) Refund(afsOrderId, userId string) (result AfsDetail, err error) { err = request.Exec(afsRefund, map[string]interface{}{ "returnOrderId": afsOrderId, "userId": userId, }, &result) return } type LogisticsAddress struct { ShopCode string `json:"shopCode"` // 店铺编码 ReceiverPhone string `json:"receiverPhone"` // 收件人手机号 ReceiverRegion string `json:"receiverRegion"` // 地区 ReceiverName string `json:"receiverName"` // 收件人 DetailAddress string `json:"detailAddress"` // 地址 ReceiverProvince string `json:"receiverProvince"` // 省 ReceiverDetailAddress string `json:"receiverDetailAddress"` // 详细地址 ReceiverCity string `json:"receiverCity"` // 城市 Id int `json:"id"` } // LogisticsAddress @Title 退款寄回地址 func (a *afs) LogisticsAddress(afsOrderId, userId string) (result LogisticsAddress, err error) { err = request.Exec(afsLogisticsAddress, map[string]interface{}{ "returnOrderId": afsOrderId, "userId": userId, }, &result) return } type BackLogisticsBill struct { UserId string `json:"userId"` // 用户id ReturnOrderId string `json:"returnOrderId"` // 退款订单id LogisticsNum string `json:"logisticsNum"` // 物流单号 LogisticsCode string `json:"logisticsCode"` // 物流编码 LogisticsName string `json:"logisticsName"` // 物流名称 ReturnAddress string `json:"returnAddress"` // 退款地址 } // BackLogisticsBill @Title 提交退款物流 func (a *afs) BackLogisticsBill(data BackLogisticsBill) error { return request.Exec(afsBackLogisticsBill, data, nil) }