Skip to content

前台订单及支付

sfyr111 edited this page Feb 26, 2018 · 1 revision

POST 创建订单

{{host}}/order/create

request

shippingId

response

{
    "status": 0,
    "msg": "创建订单成功",
    "data": {
        "order": {
            "paymentType": "在线支付",
            "postage": 0,
            "status": 10,
            "createTime": "2018-02-26T09:32:12.057Z",
            "updateTime": "2018-02-26T09:32:12.057Z",
            "id": 41,
            "userId": 12,
            "payment": "36.48",
            "orderNum": 1519639098998,
            "shippingId": "1",
            "orderStatus": "未支付"
        },
        "orderItemList": [
            {
                "id": 61,
                "userId": 12,
                "orderNum": 1519639098998,
                "productId": 7,
                "productName": "产品名称4",
                "productImage": "url1",
                "currentUnitPrice": "12.16",
                "quantity": 3,
                "totalPrice": 36.480000000000004,
                "createTime": "2018-02-26T09:32:12.043Z",
                "updateTime": "2018-02-26T09:32:12.043Z"
            }
        ],
        "shipping": {
            "id": 1,
            "userId": 12,
            "receiverName": "xiaoyang",
            "receiverPhone": "025-123",
            "receiverMobile": "12347777",
            "receiverProvince": "江苏",
            "receiverCity": "南京",
            "receiverDistrict": "江宁区",
            "receiverAddress": "一个小镇",
            "receiverZip": "210000",
            "createTime": "2018-02-19T19:01:49.000Z",
            "updateTime": "2018-02-26T09:50:11.000Z"
        },
        "host": "localhost:7071"
    }
}

GET 查询订单状态

{{host}}/order/queryOrderPayStatus?orderNum=1519639098998

request

orderNum

response

{
    "status": 0,
    "msg": "订单状态",
    "data": {
        "CODE": 10,
        "VALUE": "未支付"
    }
}

PUT 订单取消

{{host}}/order/cancel

request

orderNum

response

{
    "status": 0,
    "msg": "取消订单成功",
    "data": {
        "id": 41,
        "userId": 12,
        "orderNum": 1519639098998,
        "shippingId": 1,
        "payment": "36.48",
        "paymentType": 1,
        "postage": 0,
        "status": 0,
        "paymentTime": null,
        "sendTime": null,
        "endTime": null,
        "closeTime": "2018-02-26T10:00:49.243Z",
        "createTime": "2018-02-26T09:32:12.000Z",
        "updateTime": "2018-02-26T09:32:12.000Z"
    }
}

POST 生成支付宝支付二维码

{{host}}/order/pay

request

orderNum

response

{
    "status": 0,
    "msg": "支付宝二维码生成成功",
    "data": {
        "filename": "qr_order_1519639098998timestamps_1519639356810.png",
        "url": "localhost:7001/public/qr_order_1519639098998timestamps_1519639356810.png"
    }
}

POST 生成支付宝手机网站支付

{{host}}/order/mobilePay

request

orderNum

response

{
    "status": 0,
    "msg": "支付宝手机支付地址创建成功",
    "data": {
        "code": 0,
        "message": "success",
        "data": "https://openapi.alipaydev.com/gateway.do?app_id=2016091200492877&biz_content=%7B%22body%22%3A%22%E8%AE%A2%E5%8D%951519639098998%E8%B4%AD%E4%B9%B0%E5%95%86%E5%93%81%E5%85%B136.48%E5%85%83%22%2C%22subject%22%3A%22COOLHEADEDYANG%E6%89%AB%E7%A0%81%E6%94%AF%E4%BB%98%2C%E8%AE%A2%E5%8D%95%E5%8F%B7%3A%201519639098998%22%2C%22out_trade_no%22%3A%221519639098998%22%2C%22total_amount%22%3A%2236.48%22%2C%22product_code%22%3A%22QUICK_WAP_PAY%22%7D&charset=utf-8&format=JSON&method=alipay.trade.wap.pay&notify_url=http%3A%2F%2F9bqaiq.natappfree.cc%2Forder%2Falipaycallback&return_url=http%3A%2F%2Flocalhost%3A7071&sign_type=RSA2&timestamp=2018-02-26%2018%3A04%3A28&version=1.0&sign=b3fiIbrODX5aIKDGjab2fzW1%2BOg1vhktwUD4CoornbTOVK07uwIn8hnUdbM4pDwGA%2FQ5phl7TALRJIfYli6ce%2Blh4IbLVE%2BgUGnWxJ9pWRi1oW61inuGyePjnRc%2FrbDvQFqgH4KKitP9Fln48QqTeOn3QWUk4qvrT8z%2FhWfOe5xJfickDAqIRm%2FLlIzubJKXmASR8g93Qch1G5HJPCXa%2FD04SbkFybZgPN4C2xojrMXXMlUCPaAJfDWE4BVSEThFrU0N5lEqzgKRwtI0o4C%2BYeoqykX6UxUCGG84nBgzoOOKGLoygnv%2Fp7ZGUAUIPKV0t2ZkZzwIcxXGwsTzUXbWGQ%3D%3D"
    }
}

GET 获取购物车选中的商品快照

{{host}}/order/getOrderCartProduct

response

{
    "status": 0,
    "msg": "订单快照",
    "data": {
        "orderItemArr": [
            {
                "userId": 12,
                "quantity": 3,
                "productId": 7,
                "productName": "产品名称4",
                "productImage": "url1",
                "currentUnitPrice": "12.16",
                "totalPrice": 36.480000000000004
            }
        ],
        "orderTotalPrice": "36.48",
        "host": "localhost:7071"
    }
}

获取订单详情

{{host}}/order/detail?orderNum=1519627618362

response

{
    "status": 0,
    "msg": "订单详情",
    "data": {
        "order": {
            "id": 38,
            "userId": 12,
            "orderNum": 1519627618362,
            "shippingId": 1,
            "payment": "48.60",
            "paymentType": "在线支付",
            "postage": 0,
            "status": 20,
            "paymentTime": "2018-02-26T06:49:04.000Z",
            "sendTime": null,
            "endTime": null,
            "closeTime": null,
            "createTime": "2018-02-26T06:46:00.000Z",
            "updateTime": "2018-02-26T06:46:00.000Z",
            "orderStatus": "已支付"
        },
        "orderItemList": [
            {
                "id": 58,
                "userId": 12,
                "orderNum": 1519627618362,
                "productId": 6,
                "productName": "产品名称3",
                "productImage": "url1",
                "currentUnitPrice": "12.15",
                "quantity": 4,
                "totalPrice": "48.60",
                "createTime": "2018-02-26T06:46:00.000Z",
                "updateTime": "2018-02-26T06:46:00.000Z"
            }
        ],
        "shipping": {
            "id": 1,
            "userId": 12,
            "receiverName": "xiaoyang",
            "receiverPhone": "025-123",
            "receiverMobile": "12347777",
            "receiverProvince": "江苏",
            "receiverCity": "南京",
            "receiverDistrict": "江宁区",
            "receiverAddress": "一个小镇",
            "receiverZip": "210000",
            "createTime": "2018-02-19T19:01:49.000Z",
            "updateTime": "2018-02-26T09:50:11.000Z"
        },
        "host": "localhost:7071"
    }
}

GET 获取订单列表

{{host}}/order/list?pageNum=1&pageSize=10

request

pageNum
pageSize

response

{
    "status": 0,
    "msg": null,
    "data": {
        "list": [
            {
                "id": 41,
                "userId": 12,
                "orderNum": 1519639098998,
                "shippingId": 1,
                "payment": "36.48",
                "paymentType": "在线支付",
                "postage": 0,
                "status": 0,
                "paymentTime": null,
                "sendTime": null,
                "endTime": null,
                "closeTime": "2018-02-26T10:00:49.000Z",
                "createTime": "2018-02-26T09:32:12.000Z",
                "updateTime": "2018-02-26T09:32:12.000Z",
                "orderItemList": [
                    {
                        "id": 61,
                        "userId": 12,
                        "orderNum": 1519639098998,
                        "productId": 7,
                        "productName": "产品名称4",
                        "productImage": "url1",
                        "currentUnitPrice": "12.16",
                        "quantity": 3,
                        "totalPrice": "36.48",
                        "createTime": "2018-02-26T09:32:12.000Z",
                        "updateTime": "2018-02-26T09:32:12.000Z"
                    }
                ],
                "shipping": {
                    "id": 1,
                    "userId": 12,
                    "receiverName": "xiaoyang",
                    "receiverPhone": "025-123",
                    "receiverMobile": "12347777",
                    "receiverProvince": "江苏",
                    "receiverCity": "南京",
                    "receiverDistrict": "江宁区",
                    "receiverAddress": "一个小镇",
                    "receiverZip": "210000",
                    "createTime": "2018-02-19T19:01:49.000Z",
                    "updateTime": "2018-02-26T09:50:11.000Z"
                },
                "orderStatus": "已取消"
            },
            {
                "id": 40,
                "userId": 12,
                "orderNum": 1519639073869,
                "shippingId": 1,
                "payment": "36.48",
                "paymentType": "在线支付",
                "postage": 0,
                "status": 10,
                "paymentTime": null,
                "sendTime": null,
                "endTime": null,
                "closeTime": null,
                "createTime": "2018-02-26T09:32:12.000Z",
                "updateTime": "2018-02-26T09:32:12.000Z",
                "orderItemList": [
                    {
                        "id": 60,
                        "userId": 12,
                        "orderNum": 1519639073869,
                        "productId": 7,
                        "productName": "产品名称4",
                        "productImage": "url1",
                        "currentUnitPrice": "12.16",
                        "quantity": 3,
                        "totalPrice": "36.48",
                        "createTime": "2018-02-26T09:32:12.000Z",
                        "updateTime": "2018-02-26T09:32:12.000Z"
                    }
                ],
                "shipping": {
                    "id": 1,
                    "userId": 12,
                    "receiverName": "xiaoyang",
                    "receiverPhone": "025-123",
                    "receiverMobile": "12347777",
                    "receiverProvince": "江苏",
                    "receiverCity": "南京",
                    "receiverDistrict": "江宁区",
                    "receiverAddress": "一个小镇",
                    "receiverZip": "210000",
                    "createTime": "2018-02-19T19:01:49.000Z",
                    "updateTime": "2018-02-26T09:50:11.000Z"
                },
                "orderStatus": "未支付"
            },
            {
                "id": 39,
                "userId": 12,
                "orderNum": 1519628012048,
                "shippingId": 1,
                "payment": "36.45",
                "paymentType": "在线支付",
                "postage": 0,
                "status": 20,
                "paymentTime": "2018-02-26T06:55:42.000Z",
                "sendTime": null,
                "endTime": null,
                "closeTime": null,
                "createTime": "2018-02-26T06:48:26.000Z",
                "updateTime": "2018-02-26T06:48:26.000Z",
                "orderItemList": [
                    {
                        "id": 59,
                        "userId": 12,
                        "orderNum": 1519628012048,
                        "productId": 6,
                        "productName": "产品名称3",
                        "productImage": "url1",
                        "currentUnitPrice": "12.15",
                        "quantity": 3,
                        "totalPrice": "36.45",
                        "createTime": "2018-02-26T06:48:26.000Z",
                        "updateTime": "2018-02-26T06:48:26.000Z"
                    }
                ],
                "shipping": {
                    "id": 1,
                    "userId": 12,
                    "receiverName": "xiaoyang",
                    "receiverPhone": "025-123",
                    "receiverMobile": "12347777",
                    "receiverProvince": "江苏",
                    "receiverCity": "南京",
                    "receiverDistrict": "江宁区",
                    "receiverAddress": "一个小镇",
                    "receiverZip": "210000",
                    "createTime": "2018-02-19T19:01:49.000Z",
                    "updateTime": "2018-02-26T09:50:11.000Z"
                },
                "orderStatus": "已支付"
            },
            {
                "id": 38,
                "userId": 12,
                "orderNum": 1519627618362,
                "shippingId": 1,
                "payment": "48.60",
                "paymentType": "在线支付",
                "postage": 0,
                "status": 20,
                "paymentTime": "2018-02-26T06:49:04.000Z",
                "sendTime": null,
                "endTime": null,
                "closeTime": null,
                "createTime": "2018-02-26T06:46:00.000Z",
                "updateTime": "2018-02-26T06:46:00.000Z",
                "orderItemList": [
                    {
                        "id": 58,
                        "userId": 12,
                        "orderNum": 1519627618362,
                        "productId": 6,
                        "productName": "产品名称3",
                        "productImage": "url1",
                        "currentUnitPrice": "12.15",
                        "quantity": 4,
                        "totalPrice": "48.60",
                        "createTime": "2018-02-26T06:46:00.000Z",
                        "updateTime": "2018-02-26T06:46:00.000Z"
                    }
                ],
                "shipping": {
                    "id": 1,
                    "userId": 12,
                    "receiverName": "xiaoyang",
                    "receiverPhone": "025-123",
                    "receiverMobile": "12347777",
                    "receiverProvince": "江苏",
                    "receiverCity": "南京",
                    "receiverDistrict": "江宁区",
                    "receiverAddress": "一个小镇",
                    "receiverZip": "210000",
                    "createTime": "2018-02-19T19:01:49.000Z",
                    "updateTime": "2018-02-26T09:50:11.000Z"
                },
                "orderStatus": "已支付"
            },
            {
                "id": 35,
                "userId": 12,
                "orderNum": 1519615543540,
                "shippingId": 1,
                "payment": "60.76",
                "paymentType": "在线支付",
                "postage": 0,
                "status": 40,
                "paymentTime": "2018-02-26T04:58:52.000Z",
                "sendTime": null,
                "endTime": null,
                "closeTime": null,
                "createTime": "2018-02-26T03:24:36.000Z",
                "updateTime": "2018-02-26T03:24:36.000Z",
                "orderItemList": [
                    {
                        "id": 54,
                        "userId": 12,
                        "orderNum": 1519615543540,
                        "productId": 7,
                        "productName": "产品名称4",
                        "productImage": "url1",
                        "currentUnitPrice": "12.16",
                        "quantity": 1,
                        "totalPrice": "12.16",
                        "createTime": "2018-02-26T03:24:36.000Z",
                        "updateTime": "2018-02-26T03:24:36.000Z"
                    },
                    {
                        "id": 55,
                        "userId": 12,
                        "orderNum": 1519615543540,
                        "productId": 6,
                        "productName": "产品名称3",
                        "productImage": "url1",
                        "currentUnitPrice": "12.15",
                        "quantity": 4,
                        "totalPrice": "48.60",
                        "createTime": "2018-02-26T03:24:36.000Z",
                        "updateTime": "2018-02-26T03:24:36.000Z"
                    }
                ],
                "shipping": {
                    "id": 1,
                    "userId": 12,
                    "receiverName": "xiaoyang",
                    "receiverPhone": "025-123",
                    "receiverMobile": "12347777",
                    "receiverProvince": "江苏",
                    "receiverCity": "南京",
                    "receiverDistrict": "江宁区",
                    "receiverAddress": "一个小镇",
                    "receiverZip": "210000",
                    "createTime": "2018-02-19T19:01:49.000Z",
                    "updateTime": "2018-02-26T09:50:11.000Z"
                },
                "orderStatus": "已发货"
            },
            {
                "id": 34,
                "userId": 12,
                "orderNum": 1519573542074,
                "shippingId": 1,
                "payment": "48.62",
                "paymentType": "在线支付",
                "postage": 0,
                "status": 20,
                "paymentTime": "2018-02-26T06:44:44.000Z",
                "sendTime": null,
                "endTime": null,
                "closeTime": null,
                "createTime": "2018-02-25T15:44:10.000Z",
                "updateTime": "2018-02-25T15:44:10.000Z",
                "orderItemList": [
                    {
                        "id": 52,
                        "userId": 12,
                        "orderNum": 1519573542074,
                        "productId": 7,
                        "productName": "产品名称4",
                        "productImage": "url1",
                        "currentUnitPrice": "12.16",
                        "quantity": 2,
                        "totalPrice": "24.32",
                        "createTime": "2018-02-25T15:44:10.000Z",
                        "updateTime": "2018-02-25T15:44:10.000Z"
                    },
                    {
                        "id": 53,
                        "userId": 12,
                        "orderNum": 1519573542074,
                        "productId": 6,
                        "productName": "产品名称3",
                        "productImage": "url1",
                        "currentUnitPrice": "12.15",
                        "quantity": 2,
                        "totalPrice": "24.30",
                        "createTime": "2018-02-25T15:44:10.000Z",
                        "updateTime": "2018-02-25T15:44:10.000Z"
                    }
                ],
                "shipping": {
                    "id": 1,
                    "userId": 12,
                    "receiverName": "xiaoyang",
                    "receiverPhone": "025-123",
                    "receiverMobile": "12347777",
                    "receiverProvince": "江苏",
                    "receiverCity": "南京",
                    "receiverDistrict": "江宁区",
                    "receiverAddress": "一个小镇",
                    "receiverZip": "210000",
                    "createTime": "2018-02-19T19:01:49.000Z",
                    "updateTime": "2018-02-26T09:50:11.000Z"
                },
                "orderStatus": "已支付"
            }
        ],
        "pageNum": "1",
        "pageSize": "10",
        "total": 6,
        "host": "oss-cn-hangzhou.aliyuncs.com"
    }
}

POST 支付宝支付回调

{host}/order/alipaycallback