exchange.js 1.39 KB
/**
 *   换货 Model
 *   DOC: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/订单/exchange.md
 */

module.exports = class extends global.yoho.BaseModel {
    constructor(ctx) {
        super(ctx);
    }

    // 获取 换货列表
    getOrderData(uid, orderId) {
        return this.get({
            data: {
                method: 'app.change.goodsList',
                uid: uid,
                order_code: orderId
            },
            param: {
                cache: true,
                code: 200
            }
        });
    }

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

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

        return this.post({
            data: data
        });
    }

    /**
     * 取消换货申请
     * @param uid
     * @param id
     */
    cancelApply(uid, id) {
        return this.post({
            data: {
                uid: uid,
                id: id,
                method: 'app.change.cancel'
            }
        });
    }
};