订单信息与商品评价
好热闹TeaShop
单一商品下单
Method and Url Structure
Method |
Resource URL |
POST |
/market/product/purchase/&{pk} |
Request and Parameters
Name |
Description |
Required |
Default |
pk |
商品 pk |
YES |
|
quantity |
商品数量 |
YES |
|
address |
地址 pk |
YES |
|
Request
{
"quantity":1,
"address": 3
}
cURL Example
curl -X GET -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
http://127.0.0.1:8000/market/product/purchase/1/
JSON Response
{
"amount": "4.00",
"channel": "alipay",
"order_number": "12257268121962795696240003",
"channel_display": "支付宝",
"status": 0,
"status_display": "待付款",
"is_done": false,
"bought_product_set": [
{
"product": {
"pk": 1,
"name": "青梅绿茶",
"content": "绿茶配青梅还是头一回",
"image": "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1031155128,3611764703&fm=27&gp=0.jpg",
"price": "6.00",
"offer_price": "4.00",
"isoffer": false,
"bought": 0
},
"quantity": 1,
"amount": "4.00"
}
],
"address": {
"pk": 3,
"owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
"linkman": "陈浩南",
"telephone": "12345678",
"shipping_address": "铜锣湾",
"default": true
},
"shipped": false,
"express_name": null,
"express_number": null
}
购物车下单
Method and Url Structure
Method |
Resource URL |
POST |
/market/cart/purchase/ |
Request and Parameters
Name |
Description |
Required |
Default |
address |
地址 pk |
YES |
|
Request
{
"address":"3"
}
cURL Example
curl -X GET -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
http://127.0.0.1:8000/market/cart/purchase/
JSON Response
{
"amount": "13.00",
"channel": "alipay",
"order_number": "12257268146003115696240003",
"channel_display": "支付宝",
"status": 0,
"status_display": "待付款",
"is_done": false,
"address": {
"pk": 3,
"owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
"linkman": "陈浩南",
"telephone": "12345678",
"shipping_address": "铜锣湾",
"default": true
},
"shipped": false
}
订单列表
Method and Url Structure
Method |
Resource URL |
GET |
/market/orders/ |
cURL Example
curl -X PUT -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
http://127.0.0.1:8000/market/orders/
JSON Response
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"amount": "4.00",
"channel": "alipay",
"order_number": "12257268121962795696240003",
"channel_display": "支付宝",
"status": 0,
"status_display": "待付款",
"is_done": false,
"bought_product_set": [
{
"product": {
"pk": 1,
"name": "青梅绿茶",
"content": "绿茶配青梅还是头一回",
"image": "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1031155128,3611764703&fm=27&gp=0.jpg",
"price": "6.00",
"offer_price": "4.00",
"isoffer": false,
"bought": 0
},
"quantity": 1,
"amount": "4.00"
}
],
"address": {
"pk": 3,
"owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
"linkman": "陈浩南",
"telephone": "12345678",
"shipping_address": "铜锣湾",
"default": true
},
"shipped": false,
"express_name": null,
"express_number": null
},
{
"amount": "30.00",
"channel": "alipay",
"order_number": "12257268113481055696240003",
"channel_display": "支付宝",
"status": 0,
"status_display": "待付款",
"is_done": false,
"bought_product_set": [
{
"product": {
"pk": 2,
"name": "冰红茶",
"content": "冰力十足",
"image": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2077117511,2743730327&fm=200&gp=0.jpg",
"price": "5.00",
"offer_price": "3.00",
"isoffer": false,
"bought": 0
},
"quantity": 10,
"amount": "30.00"
}
],
"address": {
"pk": 2,
"owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
"linkman": null,
"telephone": null,
"shipping_address": null,
"default": false
},
"shipped": false,
"express_name": null,
"express_number": null
}
]
}
查看订单详情
Method and Url Structure
Method |
Resource URL |
GET |
/market/order/&{order_number} |
Request and Parameters
Name |
Description |
Required |
Default |
order_number |
订单号 |
YES |
|
Request
12257268121962795696240003
cURL Example
curl -X PUT -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
http://127.0.0.1:8000/market/order/12257268121962795696240003/
JSON Response
{
"amount": "4.00",
"channel": "alipay",
"order_number": "12257268121962795696240003",
"channel_display": "支付宝",
"status": 0,
"status_display": "待付款",
"is_done": false,
"bought_product_set": [
{
"product": {
"pk": 1,
"name": "青梅绿茶",
"content": "绿茶配青梅还是头一回",
"image": "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1031155128,3611764703&fm=27&gp=0.jpg",
"price": "6.00",
"offer_price": "4.00",
"isoffer": false,
"bought": 0
},
"quantity": 1,
"amount": "4.00"
}
],
"address": {
"pk": 3,
"owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
"linkman": "陈浩南",
"telephone": "12345678",
"shipping_address": "铜锣湾",
"default": true
},
"shipped": false,
"express_name": null,
"express_number": null
}
订单支付
Method and Url Structure
Method |
Resource URL |
PUT |
/market/order/payment/&{order_number} |
Request and Parameters
Name |
Description |
Required |
Default |
order_number |
订单号 |
YES |
|
channel |
支付方式 |
YES |
|
session |
微信获取 |
YES |
|
Request
{
"channel": "wx_small_program",
"session": "751357904584"
}
cURL Example
curl -X PUT -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
http://127.0.0.1:8000/market/order/payment/12257268125079605696240002/
JSON Response
{
"timeStamp": 1516331402,
"nonceStr": 930736358684,
"signType": "MD5",
"paySign": "4767017D1643361CF3AD372C0B1444C7",
"package": "prepay_id=wx201801191110027e5527e3990566770796"
}
取消订单
Method and Url Structure
Method |
Resource URL |
PUT |
/market/order/cancel/&{order_number} |
Request and Parameters
Name |
Description |
Required |
Default |
order_number |
订单号 |
YES |
|
Request
12257268113481055696240003
cURL Example
curl -X PUT -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
http://127.0.0.1:8000/market/order/cancel/12257268113481055696240003/
JSON Response
{
"amount": "30.00",
"channel": "alipay",
"order_number": "12257268113481055696240003",
"channel_display": "支付宝",
"status": 2,
"status_display": "取消",
"is_done": false,
"bought_product_set": [
{
"product": {
"pk": 2,
"name": "冰红茶",
"content": "冰力十足",
"image": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2077117511,2743730327&fm=200&gp=0.jpg",
"price": "5.00",
"offer_price": "3.00",
"isoffer": false,
"bought": 0
},
"quantity": 10,
"amount": "30.00"
}
],
"address": {
"pk": 2,
"owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
"linkman": null,
"telephone": null,
"shipping_address": null,
"default": false
},
"shipped": false,
"express_name": null,
"express_number": null
}
删除订单
Method and Url Structure
Method |
Resource URL |
DELETE |
/market/order/delete/&{order_number} |
Request
12257268113481055696240003
cURL Example
curl -X PUT -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
http://127.0.0.1:8000/market/order/delete/12257268113481055696240003/
确认订单
Method and Url Structure
Method |
Resource URL |
PUT |
/market/order/confirm/&{order_number} |
Request and Parameters
Name |
Description |
Required |
Default |
order_number |
订单号 |
YES |
|
Request
12257268111142305696240003
cURL Example
curl -X PUT -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
http://127.0.0.1:8000/market/order/confirm/12257268111142305696240003/
JSON Response
{
"amount": "30.00",
"channel": "alipay",
"order_number": "12257268111142305696240003",
"channel_display": "支付宝",
"status": 5,
"status_display": "确认完成",
"is_done": true,
"bought_product_set": [
{
"product": {
"pk": 1,
"name": "冰红茶",
"content": "冰力十足",
"image": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2077117511,2743730327&fm=200&gp=0.jpg",
"price": "6.00",
"offer_price": "3.00",
"isoffer": false,
"bought": 0
},
"quantity": 10,
"amount": "30.00"
}
],
"address": {
"pk": 3,
"owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
"linkman": "陈浩南",
"telephone": "12345678",
"shipping_address": "铜锣湾",
"default": true
},
"shipped": false,
"express_name": null,
"express_number": null
}
订单评价
Method and Url Structure
Method |
Resource URL |
PUT |
/market/order/evaluate/&{order_number} |
Request and Parameters
Name |
Description |
Required |
Default |
order_number |
订单号 |
YES |
|
product |
订单中商品 pk |
YES |
|
image |
图片 |
NO |
|
content |
评论 |
NO |
|
scores |
评分 |
YES |
|
Request
[
{
"product":2,
"image": "http://img.tuku.cn/file_thumb/201709/m2017092708563243.jpg",
"content":"哈哈哈哈哈哈哈哈啊哈",
"scores":5
}
]
cURL Example
curl -X PUT -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
http://127.0.0.1:8000/market/order/evaluate/12257268122989705696240003/
JSON Response
[
{
"pk": 2,
"userinfo": {
"owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
"name": "昵称",
"avatar": "https://static1.bcjiaoyu.com/head7@3x.png"
},
"product": 2,
"image": "http://img.tuku.cn/file_thumb/201709/m2017092708563243.jpg",
"content": "哈哈哈哈哈哈哈哈啊哈",
"scores": 5,
"scores_display": "五星"
}
]
查看商品评价
Method and Url Structure
Method |
Resource URL |
GET |
/market/product/evaluations/&{pk} |
Request and Parameters
Name |
Description |
Required |
Default |
pk |
商品 pk |
YES |
|
Request
2
cURL Example
curl -X PUT -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
http://127.0.0.1:8000/market/product/evaluations/2/
JSON Response
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"pk": 2,
"userinfo": {
"owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
"name": "昵称",
"avatar": "https://static1.bcjiaoyu.com/head7@3x.png"
},
"product": 2,
"image": "http://img.tuku.cn/file_thumb/201709/m2017092708563243.jpg",
"content": "哈哈哈哈哈哈哈哈啊哈",
"scores": 5,
"scores_display": "五星"
}
]
}