exchange.js 1 KB
/**
 *   换货 Model
 *   DOC: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/订单/exchange.md
 */
const api = global.yoho.API;

const exchange = {
    // 获取 换货列表
    getOrderData(uid, orderId) {
        return api.get('', {
            method: 'app.change.goodsList',
            uid: uid,
            order_code: orderId
        }, {
            cache: true,
            code: 200
        }).then(global.yoho.camelCase);
    },

    // 加载用户可选择的退货方式列表
    getDelivery(uid, areaCode) {
        return api.get('', {
            method: 'app.change.getDelivery',
            area_code: areaCode,
            uid: uid
        }, {
            cache: true,
            code: 200
        }).then(global.yoho.camelCase);
    },

    submitExchange(uid, params) {
        const data = Object.assign({
            uid,
            method: 'app.change.submit'
        }, params);

        return api.post('', data).then(global.yoho.camelCase);
    }
};

module.exports = exchange;