加载中…

读取购物车数据

```javascript WXAPI.shippingCarInfo(token, type) ``` + token 为调用登陆接口返回的用户凭证,用来标识是哪个用户的购物车; + type 购物车可以区分类型,也可以不传该参数,不传的话获取所有类型的购物车数据; 在实际应用过程中,根据业务需要,有可能需要为客户提供2个不同的购物车(例如堂食和外送区分2个购物车),那么就可以使用 type 参数来实现多购物车的场景 接口返回: ```json { "code": 0, "data": { "number": 3, // 商品数量 "score": 0, // 需要消耗多少积分 "shopList": [ // 商品归属的门店信息 { "id": 6041, "latitude": 30.29966, "longitude": 120.107697, "name": "杭州城西银泰城MALL" }, { "id": 6040, "latitude": 30.359991, "longitude": 120.057228, "name": "杭州良渚永旺Mall", "pic": "https://cdn.it120.cc/cuser/951/2017/10/31/18ae947f52231f328f4564dffbc7d72f.png" }, { "id": 0, "name": "其他", "serviceDistance": 99999999 } ], "goodsStatus": [ // 商品的状态 { "id": 810285, "sellEnd": false, // 是否停售 "sellStart": true, // 是否开始销售 "status": 0, "statusStr": "上架", "stores": 9999956 }, { "id": 435060, "sellEnd": false, "sellStart": true, "status": 0, "statusStr": "上架", "stores": 9983 }, { "id": 235853, "sellEnd": false, "sellStart": true, "status": 0, "statusStr": "上架", "stores": 5 } ], "price": 848, "items": [ { "key": "5b2a16e8d15d25b416e87f228b6d50f3", // 购物车记录唯一编号 "goodsId": 810285, // 商品ID "number": 1, // 商品数量 "sku": [ { "optionId": 30899, "optionValueId": 320215, "optionName": "网络类型", "optionValueName": "WIFI" }, { "optionId": 30900, "optionValueId": 320217, "optionName": "新订单提示", "optionValueName": "滴滴声" }, { "optionId": 30901, "optionValueId": 320220, "optionName": "切纸方式", "optionValueName": "手动撕纸" } ], "additions": [ { "id": 2833, "name": "自己对接", "pid": 852, "pname": "对接方式", "price": 0 } ], "categoryId": 1875, // 类目ID "shopId": 6041, // 门店ID "score": 0, "pic": "https://dcdn.it120.cc/2020/04/15/0a86e7ef-3680-4f9f-a22c-2afb26672b7d.png", "name": "小票打印机工厂定制版", "minBuyNumber": 1, // 至少需要购买几件 "weight": 0, "logisticsId": 386, "price": 299, "selected": true, // 是否选中 "stores": 999969, // 剩余库存 "status": 0, "statusStr": "上架" }, { "key": "d27a3ad5b78ad3edb4f51b6b23de7a07", "goodsId": 435060, "number": 1, "additions": [ { "id": 41, "name": "自己对接", "pid": 24, "pname": "对接服务", "price": 0 } ], "categoryId": 1875, "shopId": 0, "score": 0, "pic": "https://dcdn.it120.cc/2020/05/22/83618213-99b6-42ce-a672-becf466aa515.png", "name": "WiFi云标签机 FP-N20W", "minBuyNumber": 1, "weight": 0, "logisticsId": 386, "price": 499, "selected": true, "stores": 9983, "status": 0, "statusStr": "上架" }, { "key": "2096702b2b8b596ef5a4950e26be5085", "goodsId": 235853, "number": 1, "sku": [ { "optionId": 869, "optionValueId": 1698, "optionName": "花色", "optionValueName": "粉色叶子" }, { "optionId": 871, "optionValueId": 1588, "optionName": "颜色", "optionValueName": "红色" } ], "categoryId": 1875, "shopId": 6040, "score": 0, "pic": "https://dcdn.it120.cc/2019/12/06/ebf49ac6-4521-4bcc-92fd-8bbbd4131167.jpg", "name": "3分钟沙漏「儿童刷牙计时器」", "subName": "别名啦啦啦", "minBuyNumber": 1, "weight": 1.5, "logisticsId": 51089, "price": 50, "selected": true, "stores": 9989, "status": 0, "statusStr": "上架" } ] }, "msg": "success" } ```