# 结算接口

# 购物结算

调用地址 https://demo.dbshop.net/shop-api/checkout/index (opens new window)
请求方法 index 或为空
请求类型 post
参数 必填 参数说明
type 默认为空,当为buyNow为立即购买
userToken 登录状态标记
formType 默认为空,当值为 submit 时,是提交购物操作,下面的参数需要传递
deliveryType 默认是空,如果是提交订单,则值为 autoDelivery self-fetch delivery 其中之一
useIntegralNum 当使用了消费积分时,使用的消费积分数
couponId 当使用了优惠券,优惠券id
couponCode 当使用了优惠码,优惠码
addressId 当使用收货地址,收货地址id
locationId 如果是线下自提,自提点id
paymentType 支付方式,OnlinePay 在线支付,CashOnDelivery 货到付款
deliveryTimeInfo 送货时间
orderMessage 订单留言

结算页面显示

{
    "status": "success",
    "code": 200,
    "result": {
        "userAddress": [
            {
                "addressId": 3,
                "trueName": "张三",
                "regionId": 5,
                "regionValue": "北京 朝阳区",
                "addressInfo": "测试地址信息",
                "postCode": "100000",
                "areaCode": "CN",
                "phone": "17334027662",
                "addrDefault": 1,
                "userId": 11
            }
        ],
        "selfFetchList": [
            {
                "locationId": 1,
                "locationName": "测试连锁超市",
                "regionId": 5,
                "regionInfo": "北京 朝阳区",
                "locationAddress": "那个市那个区那个地",
                "locationGeoCoding": null,
                "locationPhone": "888888",
                "locationUser": "老王",
                "locationBusinessHours": "早9点-晚6点",
                "locationSort": 255,
                "locationState": 1
            }
        ],
        "orderAmount": "¥5,199.00",
        "cartAmount": "¥5,199.00",
        "cartGoodsList": [
            {
                "classId": 8,
                "goodsPrice": "¥5,199.00",
                "goodsItem": "DBS000007",
                "brandId": 0,
                "goodsName": "索尼(SONY)KD-55X8000E 55英寸 4K超高清",
                "stockId": 7,
                "goodsWeight": 0,
                "goodsWeightUnit": "克",
                "goodsWeightConversion": 1,
                "goodsState": 1,
                "goodsType": 1,
                "wholesaleState": 0,
                "goodsIntegralBuy": 0,
                "goodsUserGroupPrice": "a:1:{i:1;s:1:\"0\";}",
                "stockNum": 5,
                "stockShowState": 0,
                "cartBuyMinNum": 0,
                "cartBuyMaxNum": 0,
                "personBuyMax": 0,
                "discountPrice": "0.00",
                "discountStartTime": 0,
                "discountEndTime": 0,
                "discountUserGroupType": "allUser",
                "discountUserGroup": "N;",
                "goodsThumbnailImage": "https://demo.dbshop.net/upload/goods/image/c534950c4a79ea20293e483fd4ed4aff_thumb.jpg",
                "specTagId": null,
                "specGoodsPrice": null,
                "specGoodsStock": null,
                "specGoodsItem": null,
                "specGoodsWeight": null,
                "specGoodsUserGroupPrice": null,
                "wholesalePrice": null,
                "goodsAmount": "¥5,199.00",
                "cartId": 26,
                "userId": 11,
                "goodsId": 7,
                "inSpecGoodsId": 0,
                "inWholesaleId": 0,
                "buyNum": 1,
                "goodsChecked": 1,
                "buyNow": 0,
                "goodsRemark": null,
                "addTime": 1635929492,
                "updateTime": null
            }
        ],
        "allGoodsVirtual": false,
        "haveGoodsVirtual": false,
        "deliveryFee": 0,
        "deliveryExist": true,
        "totalWeight": 0,
        "goodsIntegralBuy": 0,
        "integral": {
            "integralType1Num": 0,
            "integralType2Num": 0
        },
        "discountCost": 0,
        "couponCodeCost": {
            "discountCost": 0,
            "showCouponCode": false
        },
        "useIntegralNum": 0,
        "integralPrice": 0,
        "useCouponList": [
            {
                "couponTitle": "满100减1元",
                "couponInfo": "满100减1元,优惠不断",
                "shoppingDiscount": 1,
                "couponId": 1
            }
        ],
        "couponPriceArray": {
            "1": 1
        },
        "addressInfo": {
            "addressId": 3,
            "trueName": "张三",
            "regionId": 5,
            "regionValue": "北京 朝阳区",
            "addressInfo": "测试地址信息",
            "postCode": "100000",
            "areaCode": "CN",
            "phone": "17334027662",
            "addrDefault": 1,
            "userId": 11
        },
        "buyNowStatus": false,
        "deliveryState": "1",
        "cashOnDelivery": {
            "paymentName": {
                "title": "支付方式名称",
                "content": "货到付款",
                "nameId": "paymentName",
                "inputType": "text",
                "class": "form-control",
                "width": "col-sm-6"
            },
            "paymentLogo": {
                "title": "支付方式Logo",
                "content": "upload/payment/cashOnDelivery.gif",
                "nameId": "paymentLogo",
                "inputType": "image"
            },
            "paymentShow": {
                "title": "显示设置",
                "content": {
                    "content1": {
                        "name": "电脑端显示",
                        "value": "pc"
                    },
                    "content2": {
                        "name": "手机端显示",
                        "value": "phone"
                    }
                },
                "nameId": "paymentShow",
                "inputType": "checkbox",
                "checked": [
                    "pc",
                    "phone"
                ]
            },
            "paymentState": {
                "title": "支付状态",
                "content": {
                    "radio1": {
                        "name": "启用",
                        "value": "1"
                    },
                    "radio2": {
                        "name": "禁用",
                        "value": "0"
                    }
                },
                "nameId": "paymentState",
                "inputType": "radio",
                "checked": "1"
            },
            "paymentSort": {
                "title": "支付排序",
                "content": "255",
                "nameId": "paymentSort",
                "inputType": "number",
                "class": "form-control",
                "width": "col-sm-2"
            },
            "onlinePayment": {
                "nameId": "onlinePayment",
                "inputType": "hidden",
                "content": "false"
            },
            "noticeMode": "nullNotice",
            "editAction": "CashOnDelivery"
        },
        "userIntegralType1Num": 0,
        "shippingDate": [
            "周一至周五送货",
            "周六、周日送货"
        ]
    }
}

提交购物结算完成

{
    "status": "success",
    "code": 200,
    "result": {
        "orderId": 14
    }
}

# 优惠|积分|优惠券 等调用

调用地址 https://demo.dbshop.net/shop-api/checkout/checkBuyGoodsUse (opens new window)
请求方法 checkBuyGoodsUse
请求类型 post
参数 必填 参数说明
buyNowStatus 0 购物车购买,1 直接购买
useIntegralNum 使用的消费积分数
couponId 优惠券id
couponCode 优惠码
deliveryType 配送类型,autoDelivery 或 self-fetch 或 delivery
addressId 收货地址id
userToken 登录状态标记
{
    "status": "success",
    "code": 200,
    "result": {
        "message": "处理完成",
        "integralPrice": "-0",
        "couponPrice": "-0",
        "couponCodePrice": "-0",
        "orderAmount": "¥2,200.00"
    }
}

# 订单微信小程序支付

调用地址 https://demo.dbshop.net/shop-api/checkout/wechatMiniOrderPay (opens new window)
请求方法 wechatMiniOrderPay
请求类型 post
参数 必填 参数说明
orderId 订单id
payCode 支付方式代码
code 小程序code
userToken 登录状态标记
{
    "status": "success",
    "code": 200,
    "result": {
        appId: "wxe5288943bxxxxxx"
        nonceStr: "V6oB6382LQxxxx"
        package: "prepay_id=wx0318365411264015e60bxxxxxxx"
        paySign: "93A1BC816823A402231450E1xxxxxx"
        signType: "MD5"
        timeStamp: "1635935813"
    }
}

# 订单余额支付

调用地址 https://demo.dbshop.net/shop-api/checkout/orderBalancePayFinish (opens new window)
请求方法 orderBalancePayFinish
请求类型 post
参数 必填 参数说明
orderId 订单id
payCode 支付方式代码
payPassword 余额支付密码
userToken 登录状态标记
{
    "status": "success",
    "code": 200,
    "result": []
}