后端:商品确认下单的信息 api 接口,后续需要结合促销,完善这个接口。
This commit is contained in:
@@ -21,6 +21,17 @@ export function cancelOrder(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getConfirmCreateOrder(skuId, quantity) {
|
||||
return request({
|
||||
url: '/order-api/users/order/confirm_create_order',
|
||||
method: 'get',
|
||||
params: {
|
||||
skuId,
|
||||
quantity,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function createOrder(params) {
|
||||
return request({
|
||||
headers: {
|
||||
|
||||
@@ -8,17 +8,22 @@
|
||||
style="background:#fff"
|
||||
>
|
||||
<template slot="thumb">
|
||||
<img :src="product.picUrl"/>
|
||||
<p v-if="product.imageTag!=null&&product.imageTag!=''" class="image_tag">{{product.imageTag}}</p>
|
||||
<!-- TODO 芋艿 暂时去掉,等会就恢复 -->
|
||||
<!-- <img :src="product.picUrls[0]"/>-->
|
||||
<!-- TODO 芋艿 暂时去掉 -->
|
||||
<!-- <p v-if="product.imageTag!=null&&product.imageTag!=''" class="image_tag">{{product.imageTag}}</p>-->
|
||||
</template>
|
||||
<template slot="tags">
|
||||
<p class="price" v-if="product.price!=null&&product.price!=''">
|
||||
<p class="price" v-if="product.price!=null && product.price !== ''">
|
||||
¥<span>{{product.price}}</span>
|
||||
<van-tag v-if="product.tags!=null" v-for="tag in product.tags" :key="tag" plain type="danger">
|
||||
{{tag}}
|
||||
</van-tag>
|
||||
<!-- TODO 芋艿 暂时去掉 -->
|
||||
<!-- <van-tag v-if="product.tags!=null" v-for="tag in product.tags" :key="tag" plain type="danger">-->
|
||||
<!-- {{tag}}-->
|
||||
<!-- </van-tag>-->
|
||||
|
||||
</p>
|
||||
<van-stepper v-if="iscard" v-model="product.quantity" :max="product.max" :min="product.min"/>
|
||||
<!-- TODO 芋艿 暂时去掉 -->
|
||||
<!-- <van-stepper v-if="iscard" v-model="product.quantity" :max="product.max" :min="product.min"/>-->
|
||||
</template>
|
||||
</van-card>
|
||||
<!-- TODO 芋艿,暂时去掉赠品 -->
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
</template>
|
||||
</van-cell>
|
||||
<div style="height:15px;"></div>
|
||||
|
||||
<div class="card" v-for="(product,i) in products" :key="i">
|
||||
<product-card :product='product'/>
|
||||
</div>
|
||||
|
||||
<div style="height:15px;"></div>
|
||||
<van-cell-group>
|
||||
<van-field
|
||||
@@ -37,10 +39,10 @@
|
||||
|
||||
<div style="height:15px;"></div>
|
||||
<van-cell-group class="total">
|
||||
<van-cell title="商品总额" value="9.99"/>
|
||||
<van-cell title="运费" value="+ 0.00"/>
|
||||
<van-cell title="折扣" value="- 5.00"/>
|
||||
<van-cell title="实付金额" value="4.99" style="font-weight: 700;"/>
|
||||
<van-cell title="商品总额" :value="fee.originalTotal"/>
|
||||
<van-cell title="运费" :value="+ fee.postageTotal"/>
|
||||
<van-cell title="折扣" :value="- fee.discountTotal"/>
|
||||
<van-cell title="实付金额" :value="fee.presentTotal" style="font-weight: 700;"/>
|
||||
</van-cell-group>
|
||||
|
||||
<div style="height:50px;"></div>
|
||||
@@ -56,7 +58,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
import {createOrder} from '../../api/order';
|
||||
import {createOrder, getConfirmCreateOrder} from '../../api/order';
|
||||
import {GetDefaultAddress} from '../../api/user';
|
||||
import orderStore from '../../store/order'
|
||||
import eventBus from '../eventBus';
|
||||
@@ -64,10 +66,25 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
from: 'direct_order', // 目前有两个来源。direct_order:直接下单; card: 购物车下单。
|
||||
|
||||
// 如下两个参数,在直接下单时使用
|
||||
skuId: this.$route.query.skuId,
|
||||
quantity: this.$route.query.quantity,
|
||||
|
||||
type: "add",
|
||||
addressData: {
|
||||
|
||||
},
|
||||
|
||||
itemGroups: [],
|
||||
fee: {
|
||||
originalTotal: undefined,
|
||||
discountTotal: undefined,
|
||||
postageTotal: undefined,
|
||||
presentTotal: undefined,
|
||||
},
|
||||
|
||||
products: [
|
||||
{
|
||||
imageURL:
|
||||
@@ -124,6 +141,9 @@
|
||||
remark,
|
||||
})
|
||||
},
|
||||
convertProduct() {
|
||||
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
if (this.$store.state.addressData.name) {
|
||||
@@ -132,14 +152,25 @@
|
||||
this.type = 'add';
|
||||
}
|
||||
this.addressData = this.$store.state.addressData;
|
||||
|
||||
// 加载商品信息
|
||||
if (this.from === 'direct_order') {
|
||||
getConfirmCreateOrder(this.skuId, this.quantity).then(data => {
|
||||
this.itemGroups = data.itemGroups;
|
||||
this.fee = data.fee;
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
// 加载地址
|
||||
GetDefaultAddress().then((result) => {
|
||||
if (result) {
|
||||
this.type = 'add1'
|
||||
this.addressData = result
|
||||
}
|
||||
})
|
||||
// 处理来源
|
||||
},
|
||||
store: orderStore,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user