goodsRemind.js 723 B

123456789101112131415161718192021222324252627282930313233
  1. import subscribe from './subscribe.js';
  2. import * as tips from './tips.js';
  3. import api from './appOnLaunch.js';
  4. import request from './request.js';
  5. const remindRequest = (goods_id) => {
  6. tips.showLoading({
  7. mask: true
  8. });
  9. request({
  10. url: api.goods.remind,
  11. data: {
  12. goods_id: goods_id
  13. }
  14. }).then(response => {
  15. tips.hideLoading();
  16. if (response.code === 0) {
  17. tips.showToast({
  18. title: '订阅成功,开售前5分钟提醒您',
  19. icon: 'none'
  20. })
  21. }
  22. }).catch(e => {
  23. tips.hideLoading();
  24. });
  25. }
  26. const remind = (template_message_list, goods_id) => {
  27. subscribe(template_message_list).then(res => {
  28. remindRequest(goods_id);
  29. }).catch((e) => {
  30. remindRequest(goods_id);
  31. });
  32. };
  33. export default remind;