Commit e1f41d77 authored by Junling Bu's avatar Junling Bu
Browse files

chore[litemall-vue]: 接入后端订单API,以及订单页面重命名

parent d10336db
...@@ -327,7 +327,7 @@ export function orderCancel(data) { ...@@ -327,7 +327,7 @@ export function orderCancel(data) {
const OrderRefund='wx/order/refund'; //退款取消订单 const OrderRefund='wx/order/refund'; //退款取消订单
export function orderRefund(data) { export function orderRefund(data) {
return request({ return request({
url: OrderSubmit, url: OrderRefund,
method: 'post', method: 'post',
data data
}) })
......
...@@ -13,14 +13,14 @@ export default [ ...@@ -13,14 +13,14 @@ export default [
} }
}, },
{ {
path: '/order/placeOrderEntity', path: '/order/checkout',
name: 'placeOrderEntity', name: 'orderCheckout',
component: () => import('@/views/order/place-order-entity') component: () => import('@/views/order/checkout')
}, },
{ {
path: '/order/orderDetail', path: '/order/order-detail',
name: 'orderDetail', name: 'orderDetail',
component: () => import('@/views/order/orderDetail') component: () => import('@/views/order/order-detail')
}, },
{ {
path: '/order/payment', path: '/order/payment',
......
...@@ -11,7 +11,7 @@ const UserInfo_SetMobile = () => import('@/views/user/user-information-set/set-m ...@@ -11,7 +11,7 @@ const UserInfo_SetMobile = () => import('@/views/user/user-information-set/set-m
const UserInfo_SetNickname = () => import('@/views/user/user-information-set/set-nickname'); const UserInfo_SetNickname = () => import('@/views/user/user-information-set/set-nickname');
const UserInfo_SetPassword = () => import('@/views/user/user-information-set/set-password'); const UserInfo_SetPassword = () => import('@/views/user/user-information-set/set-password');
const UserOrderEntityList = () => import('@/views/user/order-entity-list'); const UserOrderList = () => import('@/views/user/order-list');
const UserCouponList = () => import('@/views/user/coupon-list'); const UserCouponList = () => import('@/views/user/coupon-list');
const UserRefundList = () => import('@/views/user/refund-list'); const UserRefundList = () => import('@/views/user/refund-list');
...@@ -93,7 +93,7 @@ export default [ ...@@ -93,7 +93,7 @@ export default [
path: '/user/order/list/:active', path: '/user/order/list/:active',
name: 'user-order-list', name: 'user-order-list',
props: true, props: true,
component: UserOrderEntityList component: UserOrderList
}, },
{ {
path: '/user/coupon/list/:active', path: '/user/coupon/list/:active',
......
...@@ -252,7 +252,7 @@ export default { ...@@ -252,7 +252,7 @@ export default {
let cartId = res.data.data; let cartId = res.data.data;
setLocalStorage({ CartId: cartId }); setLocalStorage({ CartId: cartId });
that.showSku = false; that.showSku = false;
this.$router.push({ name: 'placeOrderEntity' }); this.$router.push('/order/checkout');
}); });
}, },
skuAdapter() { skuAdapter() {
......
<template> <template>
<div class="place_order_entity"> <div class="order_detail">
<div class="order-goods"> <div class="order-goods">
<van-card <van-card v-for="item in orderGoods"
v-for="item in orderGoods" :key="item.id"
:key="item.id" :title="item.goodsName"
:title="item.goodsName" desc="暂无描述"
desc="暂无描述" :num="item.number"
:num="item.number" :price="item.price +'.00'"
:price="item.price +'.00'" :thumb="item.picUrl"></van-card>
:thumb="item.picUrl"
></van-card>
<van-cell-group> <van-cell-group>
<van-cell title="商品金额"> <van-cell title="商品金额">
<span class="red">{{orderInfo.goodsPrice * 100 | yuan}}</span> <span class="red">{{orderInfo.goodsPrice * 100 | yuan}}</span>
</van-cell> </van-cell>
<van-cell title="邮费" :value="orderInfo.freightPrice "></van-cell> <van-cell title="快递费用">
<span class="red">{{orderInfo.freightPrice * 100 | yuan}}</span>
</van-cell>
</van-cell-group> </van-cell-group>
</div> </div>
<van-cell-group style="margin-top: 20px;"> <van-cell-group style="margin-top: 20px;">
<van-cell <van-cell icon="dingwei"
icon="dingwei" :title="`${orderInfo.consignee} ${orderInfo.mobile}`"
:title="`${orderInfo.consignee} ${orderInfo.mobile}`" :label="orderInfo.address" />
:label="orderInfo.address"
/>
</van-cell-group> </van-cell-group>
<van-cell-group style="margin-top: 20px;"> <van-cell-group style="margin-top: 20px;">
...@@ -38,51 +36,43 @@ ...@@ -38,51 +36,43 @@
<span>{{orderInfo.remark }}</span> <span>{{orderInfo.remark }}</span>
</van-cell> </van-cell>
<van-cell title="实付款:">
<span class="red">{{orderInfo.actualPrice * 100 | yuan}}</span>
</van-cell>
<!-- 订单动作 -->
<van-cell> <van-cell>
<template slot="title"> <van-button size="small"
<span class="custom-text">实付款:</span> v-if="handleOption.cancel"
<span class="red">{{orderInfo.actualPrice * 100 | yuan}}</span> @click="cancelOrder(orderInfo.id)"
</template> style=" float:right"
<!-- 订单动作 --> round
<van-button type="danger">取消订单</van-button>
size="small" <van-button size="small"
v-if="handleOption.cancel" v-if="handleOption.pay"
@click="cancelOrder" @click="payOrder(orderInfo.id)"
style=" float:right" style=" float:right"
round type="danger" round
>取消订单</van-button> type="danger">去支付</van-button>
<van-button <van-button size="small"
size="small" v-if="handleOption.delete"
v-if="handleOption.pay" @click="deleteOrder(orderInfo.id)"
@click="payOrder" style=" float:right"
style=" float:right" type="danger">删除订单</van-button>
round type="danger" <van-button size="small"
>去支付</van-button> v-if="handleOption.confirm"
<van-button @click="confirmOrder(orderInfo.id)"
size="small" style=" float:right"
v-if="handleOption.delete" type="danger">确认收货</van-button>
@click="deleteOrder" <van-button size="small"
style=" float:right" v-if="handleOption.refund"
type="danger" @click="refundOrder(orderInfo.id)"
>删除订单</van-button> style=" float:right"
<van-button type="danger">退款</van-button>
size="small"
v-if="handleOption.confirm"
@click="confirmlOrder"
style=" float:right"
type="danger"
>确认收货</van-button>
<van-button
size="small"
v-if="handleOption.refund"
@click="refundOrder"
style=" float:right"
type="danger"
>退款</van-button>
</van-cell> </van-cell>
</van-cell-group> </van-cell-group>
<van-cell-group v-if="showExp()" style="margin-top: 20px;"> <van-cell-group v-if="showExp()"
style="margin-top: 20px;">
<van-cell title="快递公司"> <van-cell title="快递公司">
<span>{{orderInfo.expCode }}</span> <span>{{orderInfo.expCode }}</span>
</van-cell> </van-cell>
...@@ -96,7 +86,13 @@ ...@@ -96,7 +86,13 @@
<script> <script>
import { Card, Field, SubmitBar, Button, Cell, CellGroup, Dialog } from 'vant'; import { Card, Field, SubmitBar, Button, Cell, CellGroup, Dialog } from 'vant';
import _ from 'lodash'; import _ from 'lodash';
import { orderDetail } from '@/api/api'; import {
orderDetail,
orderDelete,
orderConfirm,
orderCancel,
orderRefund
} from '@/api/api';
export default { export default {
data() { data() {
...@@ -117,31 +113,57 @@ export default { ...@@ -117,31 +113,57 @@ export default {
showExp() { showExp() {
return _.has(this.orderInfo, 'expNo'); return _.has(this.orderInfo, 'expNo');
}, },
confirmOrder(){ deleteOrder(id) {
Dialog.confirm({ let that = this;
message: '确定收货?' this.$dialog
}).then(() => { .confirm({ message: '确定要删除该订单吗?' })
}); .then(() => {
orderDelete({ orderId: id }).then(() => {
this.$toast('已删除订单');
this.$router.go(-1);
});
})
.catch(() => {});
}, },
refundOrder(){ cancelOrder(id) {
Dialog.confirm({ this.$dialog
message: '确定要取消此订单?' .confirm({ message: '确定要取消该订单吗?' })
}).then(() => { .then(() => {
}); orderDelete({ orderId: id }).then(() => {
this.init();
this.$toast('已取消该订单');
});
})
.catch(() => {});
},
confirmOrder(id) {
this.$dialog
.confirm({
message: '请确认收到货物, 确认收货后无法撤销!'
})
.then(() => {
orderConfirm({ orderId: id }).then(() => {
this.init();
this.$toast('已确认收货');
});
})
.catch(() => {});
},
refundOrder(id) {
this.$dialog
.confirm({ message: '确定要申请退款吗?' })
.then(() => {
orderRefund({ orderId: id }).then(() => {
this.init();
this.$toast('已申请订单退款');
});
})
.catch(() => {});
},
commentOrder(id) {},
toPay(id) {
this.$router.push({ name: 'payment', params: { orderId: id } });
}, },
deleteOrder(){
},
payOrder(){
},
cancelOrder(){
Dialog.confirm({
message: '确定取消此订单?'
}).then(() => {
// this.$router.go(-1);
});
},
init() { init() {
let orderId = this.$route.query.orderId; let orderId = this.$route.query.orderId;
orderDetail({ orderId: orderId }).then(res => { orderDetail({ orderId: orderId }).then(res => {
...@@ -168,7 +190,7 @@ export default { ...@@ -168,7 +190,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.place_order_entity { .order_detail {
padding-bottom: 70px; padding-bottom: 70px;
} }
</style> </style>
...@@ -145,7 +145,7 @@ export default { ...@@ -145,7 +145,7 @@ export default {
} else { } else {
this.isSubmit = true; this.isSubmit = true;
setLocalStorage({AddressId: 0, CartId: 0, CouponId: 0}); setLocalStorage({AddressId: 0, CartId: 0, CouponId: 0});
this.$router.push({ name: 'placeOrderEntity'}); this.$router.push('/order/checkout');
} }
}, },
setCheckAll(val) { setCheckAll(val) {
......
...@@ -12,41 +12,41 @@ ...@@ -12,41 +12,41 @@
finished-text="没有更多了" finished-text="没有更多了"
@load="getOrderList"> @load="getOrderList">
<van-panel v-for="(el, i) in orderList" <van-panel v-for="(el, i) in orderList"
class="order_list--panel"
:key="i" :key="i"
:title="'订单编号: ' + el.orderSn" :title="'订单编号: ' + el.orderSn"
:status="el.orderStatusText"> :status="el.orderStatusText"
<div> @click.native="toOrderDetail(el.id)">
<van-card v-for="(goods, goodsI) in el.goodsList" <van-card v-for="(goods, goodsI) in el.goodsList"
class="order_list--van-card" :key="goodsI"
:key="goodsI" :title="goods.goodsName"
:title="goods.goodsName" :num="goods.number"
:num="goods.number" :thumb="goods.picUrl">
:thumb="goods.picUrl" <div slot="desc">
@click.native="toOrderDetail(el.id)"> <div class="desc">
<div slot="desc"> <van-tag plain
<div class="van-card__desc"> style="margin-right:6px;"
<van-tag plain v-for="(spec, index) in goods.specifications"
style="margin-right:6px;" :key="index">
v-for="(spec, index) in goods.specifications" {{spec}}
:key="index"> </van-tag>
{{spec}}
</van-tag>
</div>
</div> </div>
</van-card> </div>
<div class="order_list--total">合计: {{el.actualPrice * 100 | yuan}}(含运费{{el.post_fee | yuan}}</div> </van-card>
</div> <div class="total">合计: {{el.actualPrice * 100 | yuan}}(含运费{{el.post_fee | yuan}}</div>
<div slot="footer" <div slot="footer"
class="order_list--footer_btn"> class="footer_btn">
<van-button size="small" <van-button size="small"
v-if="el.handleOption.cencel" v-if="el.handleOption.cancel"
@click="cancelOrder(el.id)">取消订单</van-button> @click="cancelOrder(el.id)">取消订单</van-button>
<van-button size="small" <van-button size="small"
v-if="el.handleOption.pay" v-if="el.handleOption.pay"
type="danger" type="danger"
@click="toPay(el.id)">去支付</van-button> @click="toPay(el.id)">去支付</van-button>
<van-button size="small"
v-if="el.handleOption.refund"
type="danger"
@click="refundOrder(el.id)">退款</van-button>
<van-button size="small" <van-button size="small"
v-if="el.handleOption.confirm" v-if="el.handleOption.confirm"
type="danger" type="danger"
...@@ -69,8 +69,8 @@ ...@@ -69,8 +69,8 @@
</template> </template>
<script> <script>
import { orderList } from '@/api/api'; import { orderList, orderDelete, orderConfirm, orderCancel, orderRefund } from '@/api/api';
import _ from 'lodash';
import { Tab, Tabs, Panel, Card, List, Tag } from 'vant'; import { Tab, Tabs, Panel, Card, List, Tag } from 'vant';
export default { export default {
...@@ -115,34 +115,65 @@ export default { ...@@ -115,34 +115,65 @@ export default {
this.finished = res.data.data.page >= res.data.data.pages; this.finished = res.data.data.page >= res.data.data.pages;
}); });
}, },
delOrder(i) { delOrder(id) {
this.$dialog.confirm({ message: '确定要删除该订单吗?' }); let that = this;
this.items.splice(i, 1); this.$dialog
this.$toast('已删除该订单'); .confirm({ message: '确定要删除该订单吗?' })
.then(() => {
orderDelete({ orderId: id }).then(() => {
this.init();
this.$toast('已删除订单');
});
})
.catch(() => {});
}, },
cancelOrder(id) { cancelOrder(id) {
this.$dialog.confirm({ message: '确定要取消该订单吗?' }); this.$dialog
this.$toast('已取消该订单'); .confirm({ message: '确定要取消该订单吗?' })
.then(() => {
orderDelete({ orderId: id }).then(() => {
this.init();
this.$toast('已取消该订单');
});
})
.catch(() => {});
}, },
refundOrder(id) {
this.$dialog
.confirm({ message: '确定要申请退款吗?' })
.then(() => {
orderRefund({ orderId: id }).then(() => {
this.init();
this.$toast('已申请订单退款');
});
})
.catch(() => {});
},
confirmOrder(id) { confirmOrder(id) {
this.$dialog.confirm({ this.$dialog
message: '请确认收到货物, 确认收货后无法撤销!' .confirm({
}); message: '请确认收到货物, 确认收货后无法撤销!'
this.$toast('已确认收货'); })
.then(() => {
orderConfirm({ orderId: id }).then(() => {
this.init();
this.$toast('已确认收货');
});
})
.catch(() => {});
}, },
commentOrder(id) {}, commentOrder(id) {},
toPay(id) { toPay(id) {
this.$router.push({ name: 'payment', params: { orderId: id } }); this.$router.push({ name: 'payment', params: { orderId: id } });
}, },
handleTabClick(index) { handleTabClick() {
this.activeIndex = index;
this.page = 0; this.page = 0;
this.orderList = []; this.orderList = [];
this.getOrderList(); this.getOrderList();
}, },
toOrderDetail(id) { toOrderDetail(id) {
this.$router.push({ this.$router.push({
name: 'orderDetail', path: '/order/order-detail',
query: { orderId: id } query: { orderId: id }
}); });
} }
...@@ -160,21 +191,24 @@ export default { ...@@ -160,21 +191,24 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.order_list { .order_list {
padding-bottom: 0; .van-panel {
&--footer_btn { margin-top: 20px;
text-align: right;
}
&--panel {
margin-bottom: 20px;
} }
&--van-card { .van-card {
background-color: #fff; background-color: #fff;
} }
&--total { .total {
text-align: right; text-align: right;
padding: 10px; padding: 10px;
} }
.footer_btn {
text-align: right;
.van-button {
margin-left: 10px;
}
}
} }
</style> </style>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment