detail-notify-api.js 867 Bytes

'use strict';

const api = global.yoho.API;

/**
 * 增加到货通知
 */
const addNotifyAsync = (skn, sku, uid, mobile) => {
    let params = {
        method: 'app.arrivalNotice.add',
        product_skn: skn,
        erp_sku_id: sku,
        uid: uid
    };

    if (mobile) {
        params.mobile = mobile;
    }

    return api.get('', params);
};

/**
 * 取消到货通知
 */
const cancelNotifyAsync = (sku, uid) => {
    return api.get('', {
        method: 'app.arrivalNotice.cancel',
        erp_sku_id: sku,
        uid: uid
    });
};

/**
 * 获得商品是否已经设置过到货通知
 */
const getNotifyStatusAsync = (sku, uid) => {
    return api.get('', {
        method: 'app.arrivalNotice.query',
        erp_sku_id: sku,
        uid: uid
    });
};

module.exports = {
    addNotifyAsync,
    cancelNotifyAsync,
    getNotifyStatusAsync
};