购物车商品列表
URL地址 | http://www.tpshop.com/index.php?m=Api&c=Cart&a=cartList |
请求方式 | post |
参数列表
参数 | 是否必须 | 说明 |
cart_form_data | 可选 | 购买的商品 |
unique_id | 必选 | 唯一id类web p端sessionid |
user_id | 可选 | 用户id 当用户登录后必传 |
token | 可选 | token |
看以下图
/* 默认传递unique_id 和 user_id 时表示查询出 unique_id user_id 用户的购物车所有的商品, 以及商品计算的总金额 由于购物车商品极多, 会修改增加删除数量, 涉及到价格变动, 这是需要传递如下json形式 cart_form_data=[{"cartID":"1027","goodsNum":"3","storeCount":"100","selected":"1"}, {"cartID":"1028","goodsNum":"2","storeCount":"100","selected":"1"}] 以上表示 carid 为 1027 的 购买数量是 3个 库存数量是 100 selected 为下拉框选中状态 以上表示 carid 为 1028 的 购买数量是 2个 库存数量是 100 selected 为下拉框选中状态 以上购物车列表, 不管是勾选复选框还是修改数量操作都只需要调用一个接口, 就是当前这个接口, 穿参数服务器自动修改, 然后返回修改后的列表,以及价格 */
成功示例
{ "status": 1, "msg": "", "result": { "total_price": { "total_fee": 3516.04, "cut_fee": -518.04, "num": 31 }, "storeList": [ { "id": 1, "name": "TPSHP旗舰店1", "cartList": [ { "id": "36", "user_id": "1", "session_id": "q4qnvqogp8nl2jkrpldv7iehf2", "goods_id": "42", "goods_sn": "TP0000042", "goods_name": "Teclast/台电 X80 Plus WIFI 32GB Win10平板电脑双系统8英寸", "market_price": "599.00", "goods_price": "499.00", "member_goods_price": "489.02", "goods_num": "2", "spec_key": "", "spec_key_name": "", "bar_code": "", "selected": "1", "add_time": "1470211036", "prom_type": "0", "prom_id": "0", "sku": "", "store_id": "1", "goods_fee": 978.04, "store_count": "101" } ] }, { "id": 2, "name": "TPSHP旗舰店2", "cartList": [ { "id": "37", "user_id": "1", "session_id": "17gef66gq602v9kevd35mi5fb5", "goods_id": "66", "goods_sn": "TP0000066", "goods_name": "迎馨家纺全棉斜纹印花双人四件套邂逅 AB版纯棉,亲肤透气", "market_price": "210.00", "goods_price": "110.00", "member_goods_price": "107.80", "goods_num": "3", "spec_key": "", "spec_key_name": "", "bar_code": "", "selected": "0", "add_time": "1470297583", "prom_type": "0", "prom_id": "0", "sku": "", "store_id": "2", "goods_fee": 323.4, "store_count": "97" } ] } ] } }