order.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import {
  2. preOrderApi
  3. } from '@/api/order.js';
  4. import util from 'utils/util'
  5. /**
  6. * 去商品详情
  7. */
  8. export function goShopDetail(item, uid) {
  9. return new Promise(resolve => {
  10. if (item.activityH5 && item.activityH5.type === "1") {
  11. uni.navigateTo({
  12. url: `/pages/activity/goods_seckill_details/index?id=${item.activityH5.id}`
  13. })
  14. } else if (item.activityH5 && item.activityH5.type === "2") {
  15. uni.navigateTo({
  16. url: `/pages/activity/goods_bargain_details/index?id=${item.activityH5.id}&startBargainUid=${uid}`
  17. })
  18. } else if (item.activityH5 && item.activityH5.type === "3") {
  19. uni.navigateTo({
  20. url: `/pages/activity/goods_combination_details/index?id=${item.activityH5.id}`
  21. })
  22. } else {
  23. resolve(item);
  24. }
  25. });
  26. }
  27. /**
  28. * 活动商品、普通商品、购物车、再次购买预下单
  29. */
  30. export function getPreOrder(preOrderType, orderDetails) {
  31. return new Promise((resolve, reject) => {
  32. preOrderApi({
  33. "preOrderType": preOrderType,
  34. "orderDetails": orderDetails
  35. }).then(res => {
  36. uni.navigateTo({
  37. url: '/pages/users/order_confirm/index?preOrderNo=' + res.data.preOrderNo
  38. });
  39. }).catch(err => {
  40. return util.Tips({
  41. title: err
  42. });
  43. })
  44. });
  45. }