468 lines
15 KiB
Vue
Raw Normal View History

2025-04-11 17:32:55 +08:00
<template>
2025-05-20 13:05:37 +08:00
<div>
<common current-name="supplier">
<template #main>
<div class="user-orders-warp">
<userHeader :title="'订单管理'"></userHeader>
<div class="user-orders-content">
<div class="order-tab">
2025-06-06 13:28:38 +08:00
<el-tabs v-model="activeCurrent" @tab-change="handleClick">
2025-05-20 13:05:37 +08:00
<el-tab-pane v-for="(t, indext) in bottomList" :key="indext" :label="t.title" :name="t.name"> </el-tab-pane>
</el-tabs>
2025-04-14 15:33:58 +08:00
</div>
2025-05-20 13:05:37 +08:00
<div class="order-list-warp">
<div class="order-list">
2025-06-06 13:28:38 +08:00
<div v-show="!show" class="empty">
<img style="width: 300px; height: 300px" src="../../assets/images/empty.png" alt="" />
</div>
<div v-for="(o, indexo) in store.data.records" v-show="show" :key="indexo" class="order-item">
2025-05-20 13:05:37 +08:00
<div class="order-item-top">
<div class="top-l">
<div class="top-item">
<div class="label">订单编号</div>
<div class="val">{{ o.orderNo || '--' }}</div>
</div>
<div class="top-item">
<div class="label">下单时间</div>
<div class="val">{{ o.createTime || '--' }}</div>
</div>
2025-04-14 15:33:58 +08:00
</div>
2025-05-20 13:05:37 +08:00
<div class="top-r">
<div class="top-item">
<div class="label">订单金额</div>
2025-06-06 13:28:38 +08:00
<div class="val amount">{{ o.totalAmount.toFixed(2) || '0.00' }}</div>
2025-04-14 15:33:58 +08:00
</div>
</div>
</div>
2025-06-06 13:28:38 +08:00
<div v-if="o.orderItemInfos && o.orderItemInfos.length > 0" class="order-item-content">
2025-05-20 13:05:37 +08:00
<div class="content-list">
2025-06-06 13:28:38 +08:00
<div v-for="(g, indexg) in o.orderItemInfos" :key="indexg" class="good-item">
2025-05-20 13:05:37 +08:00
<div class="good-img">
2025-06-06 13:28:38 +08:00
<img class="good-img" :src="g.productImage" alt="" />
<!-- <costomImg
2025-05-20 13:05:37 +08:00
:url="'images/ecommerce/' + 'pic.png'"
:preview-list="[getAssetsFile('images/ecommerce/' + 'pic.png')?.href ?? '']"
:is-view="false"
2025-06-06 13:28:38 +08:00
></costomImg> -->
2025-05-20 13:05:37 +08:00
</div>
<div class="good-info">
<div class="good-info-pos">
2025-06-06 13:28:38 +08:00
<div class="txt-ellipsis clamp2">{{ g.productName || '--' }}</div>
2025-06-11 14:35:58 +08:00
<div v-if="o.refundAuditResult == '拒绝退款' && o.orderStatus == '10'" style="color: red; font-size: 15px">
已拒绝退款{{ o.refundFailReason }}
2025-06-11 13:53:06 +08:00
</div>
2025-05-20 13:05:37 +08:00
</div>
</div>
<div class="good-price-num">
<div class="good-price-num-pos">
2025-06-11 13:53:06 +08:00
<div class="price">{{ g.unitPrice }} / {{ g.unit }} * {{ g.quantity }}</div>
2025-05-20 13:05:37 +08:00
<div class="total">
2025-06-06 13:28:38 +08:00
<div class="amount">{{ (g.unitPrice * g.quantity).toFixed(2) }}</div>
<!-- <div class="amount">{{ (g.unitPrice * g.quantity + g.carriage).toFixed(2) }}</div> -->
<!-- <div class="carriage">( 含运费{{ g.carriage.toFixed(2) }})</div> -->
2025-05-20 13:05:37 +08:00
</div>
</div>
</div>
</div>
</div>
<div class="content-right">
<div class="content-right-pos">
2025-06-06 13:28:38 +08:00
<div v-if="o.orderStatus == '1'" class="right-item do-btn">
<el-button type="primary" @click="doPay(o.id)">立即付款</el-button>
</div>
2025-06-10 18:18:52 +08:00
<div v-if="o.orderStatus == '4' || o.orderStatus == '5'" class="right-item do-btn">
<el-button type="primary" @click="sureToReceives(o.id)">确认收货</el-button>
</div>
2025-06-06 13:28:38 +08:00
<div v-if="o.orderStatus == '1'" class="right-item do-btn">
<el-button @click="doCancel(o.id)">取消订单</el-button>
2025-05-20 13:05:37 +08:00
</div>
2025-06-11 13:53:06 +08:00
<div
v-if="o.orderStatus == '2' || o.orderStatus == '3' || o.orderStatus == '4' || o.orderStatus == '5'"
class="right-item do-btn"
>
<el-button type="danger" @click="doPay(o.id)">退货/退款</el-button>
</div>
2025-06-10 18:18:52 +08:00
<!-- <div v-if="o.orderStatus == '5'" class="right-item">已发货</div> -->
<!-- <div v-if="o.orderStatus == '5'" class="right-item text-link">快递单号</div> -->
<el-button type="primary" class="right-item do-btn" @click="goInfo(o.id)">订单详情</el-button>
2025-06-06 13:28:38 +08:00
<div class="right-item text-link">
{{
o.orderStatus == '7'
? '已取消'
: o.orderStatus == '8'
? '已完成'
: o.orderStatus == '4'
? '已发货'
: o.orderStatus == '5'
? '待收货'
: o.orderStatus == '6'
? '已收货'
2025-06-10 18:18:52 +08:00
: o.orderStatus == '10'
? '退款中'
: o.orderStatus == '11'
? '已退款'
: ''
2025-06-06 13:28:38 +08:00
}}
2025-05-20 13:05:37 +08:00
</div>
</div>
</div>
2025-04-14 16:47:58 +08:00
</div>
</div>
2025-04-14 15:33:58 +08:00
</div>
2025-06-11 13:53:06 +08:00
<div class="pager">
<div style="margin-bottom: 3px">{{ total }}</div>
<el-pagination :page-size="20" :pager-count="11" layout="prev, pager, next" :total="total" @change="pagerChange" />
</div>
2025-04-14 15:33:58 +08:00
</div>
</div>
</div>
2025-05-20 13:05:37 +08:00
</template>
</common>
2025-04-14 15:33:58 +08:00
</div>
2025-04-11 17:32:55 +08:00
</template>
<script setup>
2025-06-11 13:53:06 +08:00
import { ElMessage } from 'element-plus';
2025-05-20 13:05:37 +08:00
import common from './components/common.vue';
2025-06-06 13:28:38 +08:00
import { ref, reactive, onMounted } from 'vue';
2025-04-11 17:32:55 +08:00
import { isEmpty, getAssetsFile } from '@/utils';
import { useRoute, useRouter } from 'vue-router';
2025-04-14 15:33:58 +08:00
import userHeader from './components/userHeader.vue';
2025-06-10 18:18:52 +08:00
import { cancelOrder, sureToReceive } from '../../apis/user';
2025-06-06 13:28:38 +08:00
import { useGetUserOrder } from '../../store/modules/userOrder';
let store = useGetUserOrder();
2025-04-11 17:32:55 +08:00
const route = useRoute();
const router = useRouter();
2025-06-06 13:28:38 +08:00
let page = reactive({
current: 1,
2025-06-11 13:53:06 +08:00
size: 20,
2025-06-06 13:28:38 +08:00
});
2025-06-11 13:53:06 +08:00
let total = ref(0);
2025-06-06 13:28:38 +08:00
let show = ref(false);
let handleClick = (value) => {
2025-06-10 18:18:52 +08:00
activeCurrent.value = value;
2025-06-06 13:28:38 +08:00
page.orderStatus = value;
2025-06-11 13:53:06 +08:00
if (value == 5) {
page.orderStatus = value + ',4';
}
store.getData(page).then((res) => {
total.value = res.total;
if (res.records.length > 0) {
show.value = true;
} else {
show.value = false;
}
console.log(show.value);
});
};
const pagerChange = (value) => {
console.log(page);
page.current = value;
2025-06-06 13:28:38 +08:00
store.getData(page).then((res) => {
if (res.records.length > 0) {
show.value = true;
} else {
show.value = false;
}
console.log(show.value);
});
};
const goInfo = (id) => {
router.push({
path: '/sub-operation-service/orderDetails',
2025-06-10 13:54:50 +08:00
query: { id: id, page: JSON.stringify(page) },
2025-06-06 13:28:38 +08:00
});
};
2025-04-14 15:33:58 +08:00
let bottomList = reactive([
{ title: '全部', name: 'all' },
2025-06-06 13:28:38 +08:00
{ title: '待付款', name: '1' },
{ title: '待发货', name: '3' },
2025-06-10 18:18:52 +08:00
// { title: '已发货', name: '6' },
2025-06-11 13:53:06 +08:00
{ title: '待收货', name: '4' },
2025-06-10 18:18:52 +08:00
{ title: '已收货', name: '6' },
{ title: '退款中', name: '10' },
{ title: '已退款', name: '11' },
2025-04-14 15:33:58 +08:00
]);
2025-06-06 13:28:38 +08:00
onMounted(() => {
page.orderStatus = 'all';
store.getData(page).then((res) => {
2025-06-11 13:53:06 +08:00
total.value = res.total;
2025-06-06 13:28:38 +08:00
if (res.records.length > 0) {
show.value = true;
} else {
show.value = false;
}
});
});
2025-06-10 18:18:52 +08:00
const sureToReceives = (id) => {
sureToReceive({ orderId: id }).then((res) => {
2025-06-11 13:53:06 +08:00
ElMessage({
message: '确认收货成功',
type: 'success',
plain: true,
});
2025-06-10 18:18:52 +08:00
store.getData(page);
});
};
2025-04-14 15:33:58 +08:00
let activeCurrent = ref('all');
let orderList = reactive([
{
id: '1',
orderNo: 'YH8888888888',
createTime: '2025.01.01 10:00:00',
2025-04-14 16:47:58 +08:00
payAmount: 81,
status: 0,
2025-04-14 15:33:58 +08:00
goodlist: [
{ id: '001', title: '耿马镇 原生态 有机 西红柿', price: 4.9, unit: '份', num: 10, carriage: 6 },
{ id: '002', title: '耿马镇 原生态 有机 西蓝花', price: 2.6, unit: '份', num: 10, carriage: 0 },
],
},
{
id: '2',
orderNo: 'YH8888888889',
createTime: '2025.02.01 10:00:00',
2025-04-14 16:47:58 +08:00
payAmount: 110,
status: 1,
2025-04-14 15:33:58 +08:00
goodlist: [
{ id: '001', title: '耿马镇 原生态 有机 西红柿', price: 4.8, unit: '份', num: 10, carriage: 6 },
{ id: '002', title: '耿马镇 原生态 有机 西蓝花', price: 2.5, unit: '份', num: 10, carriage: 6 },
{ id: '002', title: '耿马镇 原生态 有机 茄子', price: 2.5, unit: '份', num: 10, carriage: 0 },
],
},
2025-04-14 16:47:58 +08:00
{
id: '3',
orderNo: 'YH8888888899',
createTime: '2025.02.01 10:00:00',
payAmount: 85,
status: 2,
goodlist: [
{ id: '001', title: '勐简镇 原生态 有机 西红柿', price: 4.8, unit: '份', num: 10, carriage: 6 },
{ id: '002', title: '勐简镇 原生态 有机 西蓝花', price: 2.5, unit: '份', num: 10, carriage: 6 },
],
},
2025-04-14 15:33:58 +08:00
]);
2025-04-14 16:47:58 +08:00
2025-06-06 13:28:38 +08:00
const doPay = (id) => {
router.push({
2025-06-11 13:53:06 +08:00
path: '/sub-operation-service/orderDetails',
query: { id: id, page: JSON.stringify(page) },
2025-06-06 13:28:38 +08:00
});
};
2025-04-14 16:51:27 +08:00
2025-06-06 13:28:38 +08:00
const doCancel = (id) => {
cancelOrder({ id: id }).then((res) => {
2025-06-11 13:53:06 +08:00
ElMessage({
message: '取消订单成功',
type: 'success',
plain: true,
});
2025-06-06 13:28:38 +08:00
store.getData(page);
});
};
2025-04-11 17:32:55 +08:00
</script>
<style lang="scss" scoped>
2025-06-11 13:53:06 +08:00
.pager {
align-items: center;
display: flex;
position: fixed;
bottom: 42px;
color: #999999;
font-size: 12px;
}
2025-04-11 17:32:55 +08:00
.user-orders-warp {
width: 100%;
2025-04-14 15:33:58 +08:00
.user-orders-content {
margin-top: 16px;
2025-06-11 13:53:06 +08:00
padding: 16px 16px 30px 16px;
2025-05-20 13:05:37 +08:00
width: 100%;
2025-04-14 15:33:58 +08:00
height: calc(100vh - 136px);
2025-05-20 13:05:37 +08:00
border-radius: 16px;
background: $color-fff;
2025-04-14 15:33:58 +08:00
}
.order-tab {
width: 100%;
::v-deep() {
2025-05-20 13:05:37 +08:00
.el-tabs__nav-wrap::after {
2025-04-14 15:33:58 +08:00
background: transparent !important;
}
.el-tabs__item {
font-size: 20px !important;
}
.el-tabs__active-bar {
height: 5px !important;
border-radius: 4px;
}
.el-descriptions__label,
.el-descriptions__content {
font-size: 16px !important;
}
.cell-item {
display: inline-flex;
}
.el-descriptions__label {
color: $color-999;
}
.el-descriptions__content {
color: $color-333;
}
}
}
.order-list-warp {
2025-06-11 13:53:06 +08:00
position: relative;
2025-05-20 13:05:37 +08:00
overflow-y: auto;
2025-04-14 15:33:58 +08:00
width: 100%;
2025-04-14 15:52:40 +08:00
height: calc(100% - 60px);
2025-04-14 15:33:58 +08:00
.order-list {
width: 100%;
2025-06-06 13:28:38 +08:00
.empty {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 500px;
}
2025-04-14 15:33:58 +08:00
.order-item {
width: 100%;
.order-item-top {
display: inline-flex;
padding: 16px 0;
2025-05-20 13:05:37 +08:00
width: 100%;
2025-04-14 15:33:58 +08:00
.top-l,
.top-r {
display: inline-block;
vertical-align: middle;
}
.top-l {
display: inline-flex;
2025-05-20 13:05:37 +08:00
justify-content: flex-start;
2025-04-14 15:33:58 +08:00
width: 80%;
gap: 64px;
}
.top-r {
text-align: right;
}
.top-item {
display: inline-flex;
justify-content: flex-start;
.label,
.val {
font-size: 18px;
}
.label {
padding-right: 8px;
}
.amount::before {
content: '¥';
}
}
}
.order-item-content {
display: inline-flex;
width: 100%;
border-radius: 16px;
2025-05-20 13:05:37 +08:00
background: $color-f5;
2025-04-14 15:33:58 +08:00
.content-list,
.content-right {
display: inline-block;
vertical-align: top;
}
.content-list {
2025-04-14 16:47:58 +08:00
width: calc(100% - 160px);
2025-04-14 15:33:58 +08:00
.good-item {
display: inline-flex;
justify-content: flex-start;
margin: 8px 0;
2025-05-20 13:05:37 +08:00
padding-left: 16px;
width: 100%;
gap: 16px;
2025-04-14 15:33:58 +08:00
}
.good-img,
.good-info,
.good-price-num {
display: inline-block;
vertical-align: middle;
}
.good-img {
width: 120px;
height: 120px;
}
.good-info {
display: inline-flex;
justify-content: center;
2025-05-20 13:05:37 +08:00
width: 200px;
flex-direction: column;
2025-04-14 15:33:58 +08:00
.good-info-pos {
font-size: 18px;
color: $color-666;
}
}
.good-price-num {
display: inline-flex;
justify-content: center;
2025-05-20 13:05:37 +08:00
width: calc(100% - 340px);
2025-04-14 15:33:58 +08:00
flex-direction: column;
.good-price-num-pos {
display: inline-flex;
justify-content: space-around;
gap: 16px;
.price,
.total {
font-size: 20px;
}
.price {
font-weight: 400;
}
.total {
text-align: center;
.amount {
font-weight: 700;
2025-05-20 13:05:37 +08:00
color: $color-main;
2025-04-14 15:33:58 +08:00
}
.amount::before {
content: '¥';
}
.carriage {
font-size: 16px;
2025-05-20 13:05:37 +08:00
color: $color-666;
2025-04-14 15:33:58 +08:00
}
}
}
}
}
.content-right {
display: inline-flex;
justify-content: center;
2025-05-20 13:05:37 +08:00
width: 160px;
2025-04-14 16:47:58 +08:00
text-align: center;
2025-05-20 13:05:37 +08:00
flex-direction: column;
2025-04-14 15:33:58 +08:00
.content-right-pos {
2025-04-14 16:47:58 +08:00
.text-normal {
cursor: pointer;
font-size: 16px;
}
.text-link {
2025-05-20 13:05:37 +08:00
font-size: 16px;
2025-04-14 16:47:58 +08:00
color: $color-main;
cursor: pointer;
}
}
.do-btn {
margin-top: 8px;
2025-04-14 15:33:58 +08:00
}
}
}
}
}
}
2025-04-11 17:32:55 +08:00
}
</style>