mall-uniapp/libs/order.js

48 lines
1.2 KiB
JavaScript
Raw Normal View History

import {
preOrderApi
} from '@/api/order.js';
import util from 'utils/util'
/**
* 去商品详情
*/
export function goShopDetail(item, uid) {
2020-08-13 08:12:57 +00:00
return new Promise(resolve => {
if (item.activityH5 && item.activityH5.type === "1") {
2020-08-13 08:12:57 +00:00
uni.navigateTo({
url: `/pages/activity/goods_seckill_details/index?id=${item.activityH5.id}`
2020-08-13 08:12:57 +00:00
})
} else if (item.activityH5 && item.activityH5.type === "2") {
2020-08-13 08:12:57 +00:00
uni.navigateTo({
url: `/pages/activity/goods_bargain_details/index?id=${item.activityH5.id}&startBargainUid=${uid}`
2020-08-13 08:12:57 +00:00
})
} else if (item.activityH5 && item.activityH5.type === "3") {
2020-08-13 08:12:57 +00:00
uni.navigateTo({
url: `/pages/activity/goods_combination_details/index?id=${item.activityH5.id}`
2020-08-13 08:12:57 +00:00
})
} else {
resolve(item);
}
});
}
/**
* 活动商品普通商品购物车再次购买预下单
*/
export function getPreOrder(preOrderType, orderDetails) {
return new Promise((resolve, reject) => {
preOrderApi({
"preOrderType": preOrderType,
"orderDetails": orderDetails
}).then(res => {
uni.navigateTo({
url: '/pages/users/order_confirm/index?preOrderNo=' + res.data.preOrderNo
});
}).catch(err => {
return util.Tips({
title: err
});
})
});
}