🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
#### 列表 ~~~[api] get:/index/cart/index <<< success { "code": 1, "msg": "", "time": "2018-06-20 23:45:27", "data": [ { "id": 2, "name": "门店2", "thumb": "http://oss.dgyouduo.com/static/img/no-image.png", "goods": [ { "id": 2, "name": "测试商品1", "thumb": "http://oss.dgyouduo.com/static/img/no-image.png", "price": "100.00", "market_price": "200.00", "number": 100, "selected": 1 } ] } ] } ~~~ #### 增加 > 已存在的购物车商品数量如果超过商品当前库存,则直接设置为当前库存 > 不传 number 则数量+1 ~~~[api] post:/index/cart/increase *number:goods_id#商品ID string:sku_key=null#商品库存量单位ID number:number#数量 <<< success { "code": 1, "msg": "", "time": "2018-06-20 23:45:27", "data": [ { "id": 2, "name": "门店2", "thumb": "http://oss.dgyouduo.com/static/img/no-image.png", "goods": [ { "id": 2, "name": "测试商品1", "thumb": "http://oss.dgyouduo.com/static/img/no-image.png", "price": "100.00", "market_price": "200.00", "number": 100, "selected": 1 } ] } ] } ~~~ #### 减少 > 已存在的购物车商品数量如果超过商品当前库存,则直接设置为当前库存 > 不传 number 则数量-1 ~~~[api] post:/index/cart/decrease *number:goods_id#商品ID string:sku_key=null#商品库存量单位ID number:number#数量 <<< success { "code": 1, "msg": "", "time": "2018-06-20 23:45:27", "data": [ { "id": 2, "name": "门店2", "thumb": "http://oss.dgyouduo.com/static/img/no-image.png", "goods": [ { "id": 2, "name": "测试商品1", "thumb": "http://oss.dgyouduo.com/static/img/no-image.png", "price": "100.00", "market_price": "200.00", "number": 100, "selected": 1 } ] } ] } ~~~ #### 选中 > 门店ID或商品ID选择一个传值即可 ~~~[api] post:/index/cart/select *number:stores_id#门店ID *number:goods_id#商品ID string:sku_key=null#商品库存量单位ID <<< success { "code": 1, "msg": "", "time": "2018-06-20 23:45:27", "data": [ { "id": 2, "name": "门店2", "thumb": "http://oss.dgyouduo.com/static/img/no-image.png", "goods": [ { "id": 2, "name": "测试商品1", "thumb": "http://oss.dgyouduo.com/static/img/no-image.png", "price": "100.00", "market_price": "200.00", "number": 100, "selected": 1 } ] } ] } ~~~ #### 取消选中 > 门店ID或商品ID选择一个传值即可 ~~~[api] post:/index/cart/unselect *number:stores_id#门店ID *number:goods_id#商品ID string:sku_key=null#商品库存量单位ID <<< success { "code": 1, "msg": "", "time": "2018-06-20 23:45:27", "data": [ { "id": 2, "name": "门店2", "thumb": "http://oss.dgyouduo.com/static/img/no-image.png", "goods": [ { "id": 2, "name": "测试商品1", "thumb": "http://oss.dgyouduo.com/static/img/no-image.png", "price": "100.00", "market_price": "200.00", "number": 100, "selected": 1 } ] } ] } ~~~ #### 删除 ~~~[api] post:/index/cart/delete *array:ids#商品ID集合 <<< success { "code": 1, "msg": "", "time": "2018-06-20 23:45:27", "data": [ { "id": 2, "name": "门店2", "thumb": "http://oss.dgyouduo.com/static/img/no-image.png", "goods": [ { "id": 2, "name": "测试商品1", "thumb": "http://oss.dgyouduo.com/static/img/no-image.png", "price": "100.00", "market_price": "200.00", "number": 100, "selected": 1 } ] } ] } <<< example { "ids": [1, 2] } ~~~