- 添加订单 info
parent
0ca854587e
commit
daf3f4c8c7
|
@ -10,6 +10,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.18.0",
|
"axios": "^0.18.0",
|
||||||
|
"moment": "^2.24.0",
|
||||||
"vant": "^1.3.1",
|
"vant": "^1.3.1",
|
||||||
"vue": "^2.5.17",
|
"vue": "^2.5.17",
|
||||||
"vue-router": "^3.0.1",
|
"vue-router": "^3.0.1",
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
import request from "../config/request";
|
import request from "../config/request";
|
||||||
|
|
||||||
|
// order
|
||||||
|
|
||||||
|
export function createOrder(params) {
|
||||||
|
return request({
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
url: '/order-api/users/order/create_order',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function getOrderPage(params) {
|
export function getOrderPage(params) {
|
||||||
return request({
|
return request({
|
||||||
|
@ -32,21 +46,19 @@ export function getOrderConfirmCreateOrder(skuId, quantity) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createOrder(params) {
|
export function getOrderInfo(orderId) {
|
||||||
return request({
|
return request({
|
||||||
headers: {
|
url: '/order-api/users/order/info',
|
||||||
'Content-Type': 'application/json',
|
method: 'get',
|
||||||
},
|
params: {
|
||||||
url: '/order-api/users/order/create_order',
|
orderId,
|
||||||
method: 'post',
|
}
|
||||||
data: {
|
|
||||||
...params,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createOrderFromCart(userAddressId,
|
// Cart
|
||||||
remark) {
|
|
||||||
|
export function createOrderFromCart(userAddressId, remark) {
|
||||||
return request({
|
return request({
|
||||||
url: '/order-api/users/order/create_order_from_cart',
|
url: '/order-api/users/order/create_order_from_cart',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -57,8 +69,6 @@ export function createOrderFromCart(userAddressId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cart
|
|
||||||
|
|
||||||
export function addCart(skuId, quantity) {
|
export function addCart(skuId, quantity) {
|
||||||
return request({
|
return request({
|
||||||
url: '/order-api/users/cart/add',
|
url: '/order-api/users/cart/add',
|
||||||
|
|
|
@ -1,110 +1,176 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="background: #f7f7f7;">
|
<div style="background: #f7f7f7;">
|
||||||
<headerNav title="订单详情"/>
|
<headerNav title="订单详情"/>
|
||||||
<van-steps :active="active">
|
<van-steps :active="active">
|
||||||
<van-step>提交订单</van-step>
|
<van-step>提交订单</van-step>
|
||||||
<van-step>配送中</van-step>
|
<van-step>配送中</van-step>
|
||||||
<van-step>交易完成</van-step>
|
<van-step>交易完成</van-step>
|
||||||
</van-steps>
|
</van-steps>
|
||||||
|
<van-cell v-if="orderInfo.status >= 2 "
|
||||||
<van-cell class="logistics" to="/user/order/logistics/1" title="您的订单已由本人签收(已在配送员处采用无纸化方式签收本订单)。感谢您在京东购物,欢迎再次光临。参加评价还能赢取京豆哟。" label="2018-08-31 21:04:03" icon="logistics" is-link />
|
class="logistics"
|
||||||
<div style="height:15px;"></div>
|
to="/user/order/logistics/1"
|
||||||
<van-cell-group>
|
:title="latestLogisticsDetail.logisticsInformation"
|
||||||
<van-cell
|
:label="latestLogisticsDetail.logisticsTimeText"
|
||||||
center
|
icon="logistics"
|
||||||
:border="false"
|
is-link
|
||||||
>
|
/>
|
||||||
<template>
|
<div style="height:15px;"></div>
|
||||||
<div>张三 138****6520</div>
|
<van-cell-group>
|
||||||
<div>广东省深圳市南山区科技园 </div>
|
<van-cell
|
||||||
</template>
|
center
|
||||||
</van-cell>
|
:border="false"
|
||||||
</van-cell-group>
|
>
|
||||||
|
<template>
|
||||||
<div style="height:15px;"></div>
|
<div>{{recipient.name}} {{recipient.mobile}}</div>
|
||||||
<div v-for="(product,i) in products" :key="i">
|
<div>{{recipient.address}}</div>
|
||||||
<product-card :product='product' />
|
</template>
|
||||||
</div>
|
</van-cell>
|
||||||
<div style="height:15px;"></div>
|
</van-cell-group>
|
||||||
<van-cell-group>
|
|
||||||
<van-cell title="订单编号" value="18081609422771742" />
|
<div style="height:15px;"></div>
|
||||||
<van-cell title="下单时间" value="2018-08-16 09:42:27" />
|
<div v-for="(product,i) in products" :key="i">
|
||||||
<van-cell title="订单状态" value="配送中" />
|
<product-card :product='product'/>
|
||||||
</van-cell-group>
|
|
||||||
<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="9.99" style="font-weight: 700;" />
|
|
||||||
</van-cell-group>
|
|
||||||
<div class="footer">
|
|
||||||
<div class="munu">
|
|
||||||
<van-button size="small">确认收货</van-button>
|
|
||||||
<van-button size="small" type="danger">支付</van-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div style="height:15px;"></div>
|
||||||
|
<van-cell-group>
|
||||||
|
<van-cell title="订单编号" :value="orderInfo.orderNo"/>
|
||||||
|
<van-cell title="下单时间" :value="orderInfo.createTimeText"/>
|
||||||
|
<van-cell title="订单状态" :value="orderInfo.statusText"/>
|
||||||
|
</van-cell-group>
|
||||||
|
<div style="height:15px;"></div>
|
||||||
|
<van-cell-group class="total">
|
||||||
|
<van-cell title="商品总额" :value="orderInfo.price"/>
|
||||||
|
<van-cell title="运费" :value="'+' + orderInfo.logisticsPrice / 100"/>
|
||||||
|
<van-cell title="实付金额" :value="orderInfo.payAmount" style="font-weight: 700;"/>
|
||||||
|
</van-cell-group>
|
||||||
|
<div class="footer">
|
||||||
|
<div class="munu">
|
||||||
|
<van-button v-if="orderInfo.status === 3 " size="small">退货</van-button>
|
||||||
|
<van-button v-if="orderInfo.status === 3 " size="small" v-on:click="clickConfirmReceiving(orderId)">确认收货</van-button>
|
||||||
|
<van-button v-if="orderInfo.status === 1 " size="small" type="danger">支付</van-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
import moment from 'moment';
|
||||||
data(){
|
import { getOrderInfo, confirmReceiving } from '../../../api/order';
|
||||||
return{
|
|
||||||
active:1,
|
export default {
|
||||||
products:[
|
data() {
|
||||||
{
|
return {
|
||||||
imageURL:'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
active: 0,
|
||||||
title:'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
orderId: 0,
|
||||||
price:'499',
|
orderInfo: {},
|
||||||
quantity:2
|
recipient: {},
|
||||||
},
|
latestLogisticsDetail: {},
|
||||||
{
|
products: [
|
||||||
imageURL:'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
{
|
||||||
title:'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
imageURL: 'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
||||||
price:'499',
|
title: 'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
||||||
quantity:2
|
price: '499',
|
||||||
},
|
quantity: 2
|
||||||
]
|
},
|
||||||
|
{
|
||||||
|
imageURL: 'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
||||||
|
title: 'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
||||||
|
price: '499',
|
||||||
|
quantity: 2
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
clickConfirmReceiving(orderId) {
|
||||||
|
confirmReceiving(orderId).then(res => {
|
||||||
|
this.queryOrderPage(this.queryParams)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
const { id } = this.$route.params;
|
||||||
|
this.orderId = id;
|
||||||
|
getOrderInfo(id).then(res => {
|
||||||
|
const { status, recipient, latestLogisticsDetail} = res;
|
||||||
|
// 提交订单、配送中、交易成功
|
||||||
|
if ([1, 2].indexOf(status) !== -1) {
|
||||||
|
this.active = 0
|
||||||
|
} else if (status === 3) {
|
||||||
|
this.active = 1
|
||||||
|
} else if (status >= 4) {
|
||||||
|
this.active = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 收件人信息
|
||||||
|
this.recipient = recipient;
|
||||||
|
|
||||||
|
// 订单info
|
||||||
|
this.orderInfo = {
|
||||||
|
...res,
|
||||||
|
createTimeText: moment(res.createTime).format("YYYY-MM-DD HH:mm"),
|
||||||
|
};
|
||||||
|
|
||||||
|
// 最新物流信息
|
||||||
|
let logisticsTimeText = '';
|
||||||
|
if (latestLogisticsDetail) {
|
||||||
|
logisticsTimeText = moment(latestLogisticsDetail.logisticsTime).format("YYYY-MM-DD HH:mm");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.latestLogisticsDetail = {
|
||||||
|
...latestLogisticsDetail,
|
||||||
|
logisticsTimeText: logisticsTimeText,
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.logistics{
|
.logistics {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
i{
|
|
||||||
line-height: 60px; font-size: 20px;
|
i {
|
||||||
|
line-height: 60px;
|
||||||
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
.van-cell__title span{
|
|
||||||
overflow: hidden;
|
.van-cell__title span {
|
||||||
text-overflow: ellipsis;
|
overflow: hidden;
|
||||||
display: -webkit-box;
|
text-overflow: ellipsis;
|
||||||
-webkit-line-clamp: 2;
|
display: -webkit-box;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-line-clamp: 2;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
}
|
}
|
||||||
.van-cell__label{
|
|
||||||
color: #999;
|
.van-cell__label {
|
||||||
|
color: #999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.total{
|
|
||||||
.van-cell__value{color: red;}
|
.total {
|
||||||
}
|
.van-cell__value {
|
||||||
.footer{
|
color: red;
|
||||||
height:50px;
|
|
||||||
.munu{
|
|
||||||
position: fixed;
|
|
||||||
height: 49px;
|
|
||||||
border-top: 1px solid #e5e5e5;
|
|
||||||
bottom: 0;
|
|
||||||
background: #fff;
|
|
||||||
width: 100%;
|
|
||||||
line-height: 24px;
|
|
||||||
text-align: right;
|
|
||||||
.van-button{
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
height: 50px;
|
||||||
|
|
||||||
|
.munu {
|
||||||
|
position: fixed;
|
||||||
|
height: 49px;
|
||||||
|
border-top: 1px solid #e5e5e5;
|
||||||
|
bottom: 0;
|
||||||
|
background: #fff;
|
||||||
|
width: 100%;
|
||||||
|
line-height: 24px;
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
.van-button {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue