前端 + 后端:创建订单,接入价格计算

This commit is contained in:
YunaiV
2019-04-20 19:59:08 +08:00
parent ff69f324d5
commit 5785827748
14 changed files with 119 additions and 175 deletions

View File

@@ -59,13 +59,14 @@ export function getOrderInfo(orderId) {
// Cart
export function createOrderFromCart(userAddressId, remark) {
export function createOrderFromCart(userAddressId, couponCardId, remark) {
return request({
url: '/order-api/users/order/create_order_from_cart',
method: 'post',
params: {
userAddressId,
remark,
couponCardId,
}
});
}

View File

@@ -161,12 +161,14 @@
}
const remark = '';
const couponCardId = this.chosenCoupon >= 0 ? this.coupons[this.chosenCoupon].id : undefined;
if (this.from === 'direct_order') {
const { skuId, quantity } = this.$route.query;
const orderItems = [{
skuId,
quantity,
couponCardId,
}];
createOrder({
orderItems,
@@ -184,7 +186,7 @@
}
});
} else if (this.from === 'cart') {
createOrderFromCart(userAddressId, remark).then(result => {
createOrderFromCart(userAddressId, couponCardId, remark).then(result => {
if (result) {
// const { orderNo } = result;
this.$router.push({ //核心语句