前端 + 后端:创建订单,接入价格计算
This commit is contained in:
@@ -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,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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({ //核心语句
|
||||
|
||||
Reference in New Issue
Block a user