购物车下单

购物车下单

请求地址

POST https://{host}/openapi/cart/checkout

请求参数

属性 类型 默认值 必填 说明
x-token String 用户token

body

属性 类型 默认值 必填 说明
cartId int 购物车商品ID:如果购物车商品ID是空,则下单当前用户所有购物车商品; 如果购物车商品ID非空,则只下单当前购物车商品
addressId int 收货地址ID:如果收货地址ID是空,则查询当前用户的默认地址
couponId int 优惠券ID: 如果优惠券ID是空,则自动选择合适的优惠券。
grouponRulesId int 团购规则id

返回值

{
  "errcode": "0",
  "errmsg": "",
  "data": {
    "grouponRulesId": 2,
    "actualPrice": 5184.0000,
    "orderTotalPrice": 5184.0000,
    "cartId": 0,
    "couponId": 0,
    "goodsTotalPrice": 5184.0000,
    "addressId": 3,
    "grouponPrice": 50.0000,
    "checkedAddress": {
      "id": 3,
      "name": "ffdfd",
      "userId": 3,
      "province": "天津市",
      "city": "市辖区",
      "county": "和平区",
      "addressDetail": "adasd",
      "areaCode": "120101",
      "postalCode": null,
      "tel": "13333333333",
      "isDefault": 1
    },
    "couponPrice": 0,
    "availableCouponLength": 0,
    "freightPrice": 0,
    "checkedGoodsList": [
      {
        "id": 4,
        "userId": 3,
        "goodsId": 1085019,
        "goodsSn": "1085019",
        "goodsName": "20寸 纯PC“铝框”(非全铝)登机箱",
        "productId": 102,
        "price": 349.00,
        "number": 1,
        "specificationList": ["标准"],
        "checked": 1,
        "picUrl": "http://yanxuan.nosdn.127.net/65c955a7a98e84d44ca30bb88a591eac.png"
      }
    ]
  }
}

参数说明

属性 类型 说明
data DATA 包含返回的数据
errcode number 错误码
errmsg string 错误信息

DATA

属性 类型 说明
grouponRulesId int 团购规则id
actualPrice BigDecimal 实际金额
orderTotalPrice BigDecimal 订单费用
cartId int 购物车id
couponId int 优惠券id
goodsTotalPrice BigDecimal 商品价格
addressId int 收货地址id
grouponPrice BigDecimal 团购优惠
checkedAddress address 收货地址
couponPrice BigDecimal 优惠券金额
availableCouponLength int 获取优惠券减免金额,优惠券可用数量
freightPrice BigDecimal 运费
checkedGoodsList list(cart) 商品列表

address

属性 类型 说明
id int id
name String 收货人名称
userId int 用户表的用户ID
province String 行政区域表的省ID
city String 行政区域表的市ID
county String 行政区域表的区县ID
addressDetail String 详细收货地址
areaCode String 地区编码
postalCode String 邮政编码
tel String 手机号码
isDefault int 是否默认地址 1 默认地址 0 非默认地址

cart

属性 类型 说明
id int id
goodsId int 商品ID
goodsSn String 商品编号
goodsName String 商品名称
productId int 货品ID
price BigDecimal 商品货品的价格
number int 商品货品的数量
specificationList list(String) 商品规格值列表
checked int 购物车中商品是否选择状态,0 未选中,1 选中
picUrl String 商品图片或者商品货品图片

errcode 的合法值

说明 最低版本
-1 系统错误
0 请求成功
20001 参数为空
20003 参数错误

results matching ""

    No results matching ""